Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: user variables and bind variables in sqlplus
I do it all of the time. What I do is set up my UNIX script to set a
variable equal to the inline code of the sqlplus command. Something like
this.
the_date=`sqlplus -s username/password <<EoI
set pagesize 0 echo off verify off feedback off
select to_char(sysdate,'DD-MON-YYYY') from dual;
exit
EoI`
The << is considered a DOCUMENT file and takes all lines until a line beginning with the label (EoI in this case) is encountered. Since I used gravee characters, the sqlplus command is executed inline. The sql code generates a single value (per the formatting) which is all that is echoed from the sqlplus command. That echo in turn is loaded into the environment variable 'the_date'. From there, I can use the date anywhere in my shell script.
I hope this helps you.
-----Original Message-----
From: Adams, Matthew (GEA, 088130) [SMTP:MATT.ADAMS_at_APPL.GE.COM] Sent: Monday, November 27, 2000 3:00 PM To: Multiple recipients of list ORACLE-L Subject: user variables and bind variables in sqlplus
I'm using sqlplus 3.2.3 and pl/sql 2.2.3 (the versions that came with rdbms 7.2.3) and I'm stuck.
I need to get a result from a select statement and return it to the unix shell script environment.
Getting the result into a bind variable is a relatively trivial excersice, but in this version of sqlplus, the quit command does not accecpt a bind variable argument, only a user variable arguement.
I can't figure it out. Anybody done this with this relatively old software?
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Liststo: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Mon Nov 27 2000 - 16:06:24 CST
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message