Re: Any good coders out there? Perl?



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
.



Relevant Pages

  • Re: [PHP] retrieve POST body?
    ... If I do go the route of using something else to accept the form data and then executing the PHP script, I'd be leaning more toward somehow executing the PHP script directly rather then sending back a redirect to the user-agent to re-send the request to the PHP script. ... Reconstruct an identical POST body from the $_POSTarray, with some trial-and-error form field renaming and placement of uploaded files. ... This would allow future improved operation in case the feature request ever materializes, or a sysadmin uses an external process (Perl or whatever else) to dump the POST body to a file. ...
    (php.general)
  • Re: Problems of PHP script running Perl program with Spreadsheet::ParseExcel module
    ... Spreadsheet::ParseExcel module to parse Excel file. ... php script from command line so that perl script can run and properly ... then launch php through client request, perl program can't run. ...
    (comp.lang.php)
  • Re: questions about heredocs
    ... > What's strange is that I found my answer in a PHP book! ... > The following works as a php script but not as a perl script (removed ... > From the sparse examples that I could find with heredocs and perl, ...
    (perl.beginners)
  • Re: php and perl in one file.
    ... >> i dont wana call php script from perl. ... >> i wana write the php script in the same file of perl script. ... Prev by Date: ...
    (comp.lang.perl.misc)
  • questions about heredocs
    ... The following works as a php script but not as a perl script (removed ... From the sparse examples that I could find with heredocs and perl, ... No documentation was found for and [perldoc ...
    (perl.beginners)