LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 06-11-2012, 12:00 PM   #1
beeblequix
Member
 
Registered: Oct 2005
Location: Tierra Firma, Earth
Distribution: Debian of course...
Posts: 198

Rep: Reputation: 30
DB2 user needs help using Oracle SQL*Plus


I've depended on DB2's ability to run outside of interactive mode in my bash scripts. I like how I can throw DB2 commands at the database and on the next line run awk/sed/grep/etc. Now I've got to do the same thing but on an Oracle database using SQL Plus.

What's the SQL Plus version of these DB2 non-interactive commands?

1. db2 connect to SOMEDATABASE user SOMEUSER using SOMEPASSWORD

2. db2 -x "select count(*) from SOME_TABLE where TRANSACTION_TIME between '2012-06-11 10:30:00.000' and '2012-06-11 10:30:10.999'"

Thanks.
 
Old 06-18-2012, 11:11 AM   #2
john2
Member
 
Registered: Aug 2004
Location: Wales
Distribution: Manjaro, Kubuntu, MX
Posts: 102

Rep: Reputation: 29
It's been a while since I used Oracle, but as there are zero replies so far here goes...

As far as I remember the syntax for the first one is
CONN username/password@identifier
http://docs.oracle.com/cd/B19306_01/...57/ch12015.htm

The second one needs the TO_DATE function - examples here:
http://psoug.org/definition/TO_DATE.htm

If you want to send the output to a file you need the SPOOL command
http://www.exampledepot.com/egs/java...bleToFile.html

To run sqlplus from bash scripts:
http://www.dbsnaps.com/oracle/oracle...-bash-scripts/

Hope this is of help.

Last edited by john2; 06-18-2012 at 11:26 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Problem on DB2 Sparkle1984 Linux - Software 2 06-28-2010 04:49 AM
ORACLE - Tacking SQL all sessions for 1 user ? czezz Programming 0 06-09-2009 04:49 AM
LXer: Use XML in DB2 SQL stored procedures LXer Syndicated Linux News 0 01-20-2007 04:03 AM
IBM DB2 sql troubles Reegz Programming 0 12-14-2006 01:54 AM
LXer: Mix and Match SQL and XML with DB2 Viper hybrid LXer Syndicated Linux News 0 02-17-2006 06:46 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 05:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration