1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
:

This command is used to make a query to oracle using SQL Plus and a username/password/host. Prior you need to define Oracle enviroment variables.

Module data

Sample Oracle enviroments variables: 

export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server 
export ORACLE_SID=XE 
export ORACLE_VER=10.2.0 
export PATH=$PATH:$ORACLE_HOME/bin 

Sample query: 

echo "SELECT USER_ID FROM DEMO_USERS where USER_NAME = 'ADMIN';" | /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplus -S -L hr/[email protected] | tail -2 | head -1 | awk '{ print $1 }' 

Dont miss the final “;” at the end of SQL sentence

(Visited 166 times, 1 visits today)