Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: perl script and Oracle
In article <7g6tmm$g6n$1_at_sloth.swcp.com>,
elufker_at_swcp.com (Ed Lufker) wrote:
> Hi all:
>
> Can perl script run or call an oracle procedure and also pass
> parameters to the procedure. Any examples of code would be great.
>
> thanks for any help here
> eddie lufker
>
>
how about this???
since perl executes OS commands via ` ... `,
given:
cat p2o0.sql - perl 2 oracle
spool p2o0
select username from dba_users where username like '&1%';
spool off
exit
cat p2o0.pl
#!/usr/local/bin/perl -w
#
$x=`/bin/ksh export ORACLE_BASE=/oracle`; $x=`/bin/ksh export ORACLE_HOME=/oracle/product/7.3.3`; $x=`/bin/ksh export ORACLE_SID=dojv`; $x=`/bin/ksh PATH=\$PATH:\$ORACLE_HOME/bin`; $x=`sqlplus u001/pass \@p2o0 $ARGV[0]`;open (OLD,'p2o0.lst');
print;
}
close(OLD);
now from unix run:
unix >p2o0.pl M
results in:
/usr/accts/oracle >p2o0.pl M
old 1: select username from dba_users where username like '&1%'
new 1: select username from dba_users where username like 'M%'
USERNAME
/usr/accts/oracle >
this is executing a script, but it could just as easily execute a procedure. Hope this helps!
PS: see http://www.holg.com/oracle/monitor for an original use of Perl and Oracle.
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Wed May 05 1999 - 17:14:34 CDT