Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Getting values into SQLPLUS from Unix
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.comReceived on Thu Dec 15 2005 - 15:43:50 CST
![]() |
![]() |