Re: Oracle Stored procedure calls from Perl

From: Tim Bunce <Tim.Bunce_at_ig.co.uk>
Date: 1997/06/26
Message-ID: <ECEA3n.8t2_at_ig.co.uk>#1/1


In article <33B0348D.5D51_at_lds.com>, Michael Shannon <mshannon_at_lds.com> wrote:
> This seems to be a common question, that has some vague responses. I
> need to be able to call an Oracle stored procedure from perl, that
> actually returns some results. For example,
> I have an Oracle stored procedure that accepts an ID as a parameter, and
> based on that parameter, returns a social security number and a date of
> birth. Real straight forward stuff. Can I get a straight forward way to
> do this using the DBD/DBI Oracle stuff.
>
> I have read in previous threads that their is an example(test_psql) of
> this in Test.pl, but our installations of DBD-Oracle-0.45 & DBI-0.84
> have the test.pl but make no mention of test_psql.

In recent releases take a look at t/plsql.t.

Here's a complete (but untested) example based on the latest DBI:

	use DBI;
	$id  = 0;
	$ssn = 0;
	$dbh = DBI->connect('dbi:Oracle:',$user,$pass);
	$csr = $dbh->prepare(q{
	    begin :ssn = your_proc_name(:id) end;
	});
	$csr->bind_param(':id', $id);
	$csr->bind_param_inout(':ssn', \$ssn, 100);
	$csr->execute;
	print "social security number: $ssn\n";

I don't see how the DBI could make it much easier!

Tim. Received on Thu Jun 26 1997 - 00:00:00 CEST

Original text of this message