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: Getting values into SQLPLUS from Unix

Re: Getting values into SQLPLUS from Unix

From: Mladen Gogala <gogala_at_sbcglobal.net>
Date: Thu, 15 Dec 2005 21:43:50 GMT
Message-Id: <pan.2005.12.15.21.43.50.46112@sbcglobal.net>


On Thu, 15 Dec 2005 07:49:03 -0800, amerar_at_iwc.net wrote:

> Hi,
>
> I have some small code that looks like this:
>
> sqlplus /nolog <<EOF
> connect / as sysdba
> ALTER SESSION SET CURRENT_SCHEMA=&1
> exec dbms_snapshot.refresh(UPPER('&1.&2'));
> exit
> EOF
>
> I want to pass in the values for &1 and &2........I am calling this
> from a Unix shell script. Any ideas?
>
> Thanks,
>
> Arthur

Here is the same solution as given by Chris Carampa, only re-iterated. I'm repeating it because I wrote the script before I read the replies and it would be a terrible thing that a good script goes to waste:

$ cat /tmp/ttt
#!/bin/sh
sqlplus -s /nolog <<EOF
connect scott/tiger
select * from emp
where ename=upper('$1');
exit;
EOF
$
$ /tmp/ttt king

     EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO


      7839 KING       PRESIDENT            17-NOV-81       5000
        10



-- 
http://www.mgogala.com
Received on Thu Dec 15 2005 - 15:43:50 CST

Original text of this message

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