Re: SQLPlus with Perl



xhoster@xxxxxxxxx wrote:
"The alMIGHTY N" <natlee75@xxxxxxxxx> wrote:
Hi all,

I've been assigned a project involving SQLplus calls to an Oracle
database within Perl code. I have examples of how to perform insert and
update statements that don't return anything back to the code, but I
now need to perform a select statement to check values in the database.

How would I go about executing SQLplus calls and assigning the results
to a Perl string or array?

SQL*Plus is Oracle's command line user interface for a *human* to connect
to and use an Oracle database. Perl is not a human. 99+% of the time,
you should use DBI and DBD::Oracle, not SQL*Plus, to connect Perl to an
Oracle database server. It might take a little more work to get
DBD::Oracle installed and set up, but from then on it will be much better
than hacking things together with SQL*Plus.

That said, you could run sqlplus in backticks and parse the returned
value.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB

Hi, thanks for the reply! After all the searching I've done these past
couple of days, I came to the same conclusion. I'm putting together a
quick script that uses DBI to do everything, but I'm still holding out
hope that there's some solution to this (the senior developers are not
keen on adding a new module to the system especially since this is such
a small part of the applicatiion).

How would one go about running sqlplus "in backticks"?

Thanks,

NL

.



Relevant Pages

  • RE: Memory fault(coredump) with two DBD type connections
    ... I get a core dump ... all the libraries are the same threaded model(single threaded perl uses ... I am running Perl 5.8.8 with DBD-Oracle 1.19 compiled against Oracle ... when I try to connect to the same Oracle database AND same DB2 database ...
    (perl.dbi.users)
  • RE: Perl Oracle incompatibility
    ... Moreover i have not done any changes except to upgrade my Oracle ... database and nothing else. ... Subject: Perl Oracle incompatibility ...
    (perl.dbi.users)
  • RE: Breakable
    ... One of the problems with this is that sqlplus assumes that the user must ... permissions to run svrmgrl as the oracle user so they can ... at least pose some other security risks. ... the database rather than the client also suggests to me that Oracle's ...
    (Bugtraq)
  • RE: Problem with connecting to an Oracle database using Perl
    ... specifically ORACLE_HOME and maybe the NLS vars. ... Problem with connecting to an Oracle database using Perl ...
    (perl.dbi.users)
  • Re: DBD::Oracle crashes non-deterministic
    ... No, unfortunately it really CRASHES perl, i.e. it dumps core in the oracle ... One difference we have found is that if we are targetting a 9i R2 Database ...
    (perl.dbi.users)

Loading