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: Perl - Newbie question

Re: Perl - Newbie question

From: <dbaplusplus_at_hotmail.com>
Date: 11 Jun 2006 19:00:28 -0700
Message-ID: <1150077628.322541.86290@h76g2000cwa.googlegroups.com>

dbaplusplus_at_hotmail.com wrote:
> Mladen Gogala wrote:
> > On Tue, 06 Jun 2006 14:05:46 -0700, dbaplusplus wrote:
> >
> > >
> > > How do I do same in Perl. I did search on Google but gives the always
> > > found information on DBI interface, but not on what I am looking for.
> >
> >
> > I have a tutorial on my page which shows how to execute PL/SQL from DBI.
> > Alternatively, you can always execute using system(). The command
> > perldoc -f system will tell you how to execute sqlplus from within the
> > Perl interpreter. If my question is not too brazen, why would you want
> > to call sqlplus, when DBI is much more convenient and can be used for
> > programming, in contrast with sqlplus internal variables?
> >
> > --
> > http://www.mgogala.com
>
> Thanks. Does not like DBI and Oracle driver for DBI are part of Oracle
> install. I am using Oracle 9.2.0.5 on UNIX. I will hav eto download
> them from cpan.

I finally figured how to do what I want in Perl. Perl has a way to implement UNIX's here document, and then one can use system to run the command.
$cmd << END
sqlplus /.nolog << !
conn scott/tiger
sql statement 1;
pl/sql block1 ;
/
!
END
system ("$cmd");

Thus with a few extra lines (in comparision to ksh scripts) I can take full advantage of sqlplus inside perl scripts.

Nice thing about perl is most of it can be run on Microsoft WIndows as well becaus perl is
provided on Windows 2000 etc as part of WIndows OS installation. Received on Sun Jun 11 2006 - 21:00:28 CDT

Original text of this message

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