Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!p01!fed1read02.POSTED!53ab2750!not-for-mail
Newsgroups: comp.databases.oracle.server
Subject: Re: Perl - Newbie question
From: ianal Vista <ianal_vista@hotmail.com>
References: <1149627946.026944.302980@h76g2000cwa.googlegroups.com>
Message-ID: <Xns97DA9E78C7213ianalvistahotmailcom@70.169.32.36>
User-Agent: Xnews/5.04.25
Lines: 36
Date: Tue, 06 Jun 2006 22:34:04 GMT
NNTP-Posting-Host: 70.181.220.125
X-Complaints-To: abuse@cox.net
X-Trace: fed1read02 1149633244 70.181.220.125 (Tue, 06 Jun 2006 18:34:04 EDT)
NNTP-Posting-Date: Tue, 06 Jun 2006 18:34:04 EDT
Organization: Cox Communications
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.server:268660

dbaplusplus@hotmail.com wrote in news:1149627946.026944.302980
@h76g2000cwa.googlegroups.com:

> I know Perl has a DBI interface for Oracle, but my question is not
> about that interface.  My question is how to invoke sqlplus command
> line interface from Perl scripts. My perl script is doing some other
> things already and I want to invoke some sql and Pl/SQL code.
> 
> 
> For example, in Windows .bat file or UNIX .ksh:
> 
> Sqlplus login/password @mysql.sql
> 
> Or  in UNIX ksh:
> 
> Sqlplus login/password << !
> Select * from test;
> Declare
> Begin
>     /* some PL/SQL CODE */
> End;
> 
> !
> 
> How do I do same in Perl. I did search on Google but always found
> information on DBI interface, but not on what I am looking for.
> 
> 

Just as you'd invoke any other command line utility -
system("env > /tmp/my.env");
system("sqlplus login/password @mysql.sql");

BUT keep in mind that the new shell environment will likely NOT have 
current shell environmental variable values!

