Cover by Wolfgang Barth

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

26.3 A Wrapper Plugin for sqlplus

To query an Oracle database, sqlplus is given the appropriate SQL statement via standard input and receives a reply via the standard output:

user@linux:~$ echo "select trash from nothing" |\
 sqlplus -i wob/password@//192.168.1.9/DEMO
select trash from nothing
               *

ERROR at line 1:
ORA-00942: table or view does not exist

The switch -s (silent) prevents the output of things like version and copyright, and restricts the reply to the really interesting part. If the query fails, as above, the text merely points out the error that has occurred. sqlplus itself only returns an error status as a return value if the error occurred when using the client itself, otherwise it just returns OK (command executed). This is why sqlplus ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required