Oracle Technology Blog

OraTech Blog provides tips,tricks,scripts and how-to type answers for Oracle related technologies. I use these commands very often, so I thought it would be useful to share with everybody. Please feel free to include your comments/corrections/questions.

Tuesday, May 30, 2006

Return a result from SQL*Plus to Unix variable

$ cat a.sh
#!/bin/sh
var="set pagesize 0
select * from v\$instance;"
nad=$(print "$var" | sqlplus -s "/ as sysdba")
echo $nad
$ a.sh
1 mydb_name myhostname 9.2.0.6.0 16-MAY-06 OPEN YES 1 STARTED ALLOWED NO ACTIVE PRIMARY_INSTANCE NORMAL

0 Comments:

Post a Comment

<< Home