Saturday, October 08, 2011

SQLPLUS Script in UNIX Shell Produce Output on Same Line

A Simple Select statement is executed from CURRENT a shell. The value returned by the select query is transferred back to the shell.

For example:

RESULT=`sqlplus -s apps/WELCOME123@DEVPR12 < <(printf "set pages 0 \n select SYSDATE from dual; \n")`
echo "RESULT=${RESULT}"

Another Way to Execute sqlplus from unix shell

sqlplus -s /nolog << EOF
connect apps/Welcome123
select sysdate from dual;
exit;
EOF

3 comments:

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
ccsu ba second year result name wise said...

First You got a great blog. I will be interested in more similar topics. I see you got really very useful topics, I will be always checking your blog thanks.