Re: Any good coders out there? Perl?
- From: Mladen Gogala <mgogala.SPAM_ME.NOT@xxxxxxxxxxx>
- Date: Fri, 23 Mar 2007 00:24:55 GMT
On Wed, 21 Mar 2007 09:13:35 -0700, amerar@xxxxxxx wrote:
Hi All,
I need to convert a PHP script into Perl. This PHP script interacts
with our Oracle database. It executes some stored procedures and
returns values. I've pasted the PHP code below, I'm just not sure how
to code it in Perl & DBI. Can anyone help?? I would really appreciate
it.
I am not a coder but a DBA. Hopefully, that will not be held against me.
I was trying to use your code conventions as much as possible. Here's the
code:
#!/usr/bin/perl -w
use strict;
use DBI;
use DBD::Oracle qw(:ora_types);
my $curs;
my $conn = db_connect( "scott", "tiger", "ABCD.world" );
my $PLSQL = "begin
BEGIN AUTO_CHARGE.EXP_RENEW_SUBSCR(:data);
end;";
my $stmt = $conn->prepare($PLSQL);
$stmt->bind_param_inout( ":data", \$curs, 0, { ora_type => ORA_RSET } );
$stmt->execute();
while ( my ( $cust_id, $own, $type, $code ) = $curs->fetchrow_array() ) {
print "You should get one of these for each row\n";
}
END {
$conn->disconnect() if defined($conn);
}
sub db_connect {
my ( $username, $passwd, $db ) = ( @_, $ENV{"TWO_TASK"} );
my $dbh = DBI->connect( "dbi:Oracle:$db", $username, $passwd )
|| die( $DBI::errstr . "\n" );
$dbh->{AutoCommit} = 0;
$dbh->{RaiseError} = 1;
$dbh->{ora_check_sql} = 0;
$dbh->{RowCacheSize} = 128;
$dbh->{ora_array_chunk_size}=128;
return ($dbh);
}
--
http://www.mladen-gogala.com
.
- References:
- Any good coders out there? Perl?
- From: amerar@xxxxxxx
- Any good coders out there? Perl?
- Prev by Date: RE: Regarding Steps to How to compile the 32 bit perl library with 64 bit oracle ?
- Next by Date: RE: Internal Error while compiling Pro*C program
- Previous by thread: Any good coders out there? Perl?
- Next by thread: Re: Any good coders out there? Perl?
- Index(es):
Relevant Pages
|
|