Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL*plus output etc
If you are using Perl, then using SQL*Plus for you SQL queries is not the "preferred" method. Instead, you will want to use the DBI module. Install the DBI (database interface) module and also install the Oracle DBD (database driver) module. Then you can connect to the database, run queries, and loop through the results. To get more information, type "perldoc dbi" after you have installed the above modules.
HTH,
Brian
Zhiliang Hu wrote:
>
> Thanks to all who replied my earlier question -- I can't thank enough
> for those of you who spent time, offered not only help but also
> education
> to a novice :)
>
> Here I got another problem that I don't understand ...
>
> I am writing a perl script to do Oracle database queries using SQL*Plus'
>
> silent mode. Things have been smooth -- i.e. I embed SQL in Perl, and
> use command line Perl script to do my query and data processing etc.
> Here I come to a situation where I need to parse a list of (single)
> names
> queried from Oracle and use "foreach" to loop for further queries:
>
> @results = (queried list of names);
> foreach $name(@results) {
> do 2nd query "where=$name";
> }
>
> However, to my surprise the "$name" in foreach holds the whole list of
> values in "@results", although the print out of "@results" shows
> separate
> lines of each "name". Is there anything special in SQL*Plus output that
>
> prevent the perl from parsing the list in "foreach"?
>
> (I checked on perl side -- it parses a list for no problem if it read
> from
> a file, but not from SQL*Plus).
>
> Thanks in advance!
>
> Zhiliang
-- ======================================== Brian Peasland Raytheons Systems at USGS EROS Data Center These opinions are my own and do not necessarily reflect the opinions of my company! ========================================Received on Mon Apr 09 2001 - 08:11:06 CDT
![]() |
![]() |