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: Mladen Gogala <gogala_at_sbcglobal.net>
Date: Wed, 07 Jun 2006 17:40:43 GMT
Message-ID: <vcEhg.133340$F_3.107033@newssvr29.news.prodigy.net>


dbaplusplus_at_hotmail.com wrote:

> ianal Vista wrote:

>> dbaplusplus_at_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!
> 
> Thanks, that is a good starting point for me.
> 

Of course, you can try with

open FH,"|sqlplus login/password";
print "select * from all_objects;\n";

-- 
Mladen Gogala
http://www.mgogala.com
Received on Wed Jun 07 2006 - 12:40:43 CDT

Original text of this message

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