Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Combine Unix variable with Oracle variable

Re: Combine Unix variable with Oracle variable

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 15 Jun 2006 23:11:11 +0200
Message-ID: <d4j3925a5sebh5hmj6v63fr7jqgvqbdope@4ax.com>


On Thu, 15 Jun 2006 18:37:22 GMT, Kenneth Koenraadt wrote:

>On 15 Jun 2006 10:06:25 -0700, "aman.oracle.dba"
><aman.oracle.dba_at_gmail.com> wrote:
>
>>Hello DBAs,
>>
>>Please tell how to send any bind variable value to unix variable.
>>Example
>>in unix
>>
>>$a=10
>>$sqlplus "/ as sysdba"
>>sql>variable b number:=10;
>>
>>Now I want to compare b and a in shell scripting and in one pl code
>>also but how is it possible.Please help..........
>>
>>Thank You
>>
>
>Hi there,
>
>
>1) Passing parameters from shell script to sql*plus :
>
>
>parameter1=20
>parameter2=30
>sqlplus user/pw_at_db @myscript.sql $parameter1 $parameter2
>
>and myscript.sql receives the parameters via the default prefix '&'
>(can be changed) :
>
>myscript.sql
>----------------
>set serveroutput on;
>
>begin
> if '&1' = '&2' then
> dbms_output.put_line('They matched');
> else
> dbms_output.put_line('They did not match');
> end if;
>end;
>/
>exit;
>
>----------------
>
>
>2) Passing parameter from sql*plus to shell script :
>
>set serveroutput on;
>define parm1=4
>define parm2=5
>host myscript.sh &parm1 &parm2
>
>- Kenneth Koenraadt

envvar="`sqlplus -s username/password @script`" works nicely
as long as you
set feedback off newpage 0 pagesize 0

--
Sybrand Bakker, Senior Oracle DBA
Received on Thu Jun 15 2006 - 16:11:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US