Re: Any good Perl coders out there?
- From: nospam@xxxxxxxxxxxxx (Jamie)
- Date: Wed, 21 Mar 2007 22:07:57 GMT
In <GMhMh.21970$Uk6.15371@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
Timo Jokinen <jokinentimo@xxxxxxxxxxxxxxxxxxx> mentions:
Michael Vilain wrote:
In article <1174493670.753360.57970@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"amerar@xxxxxxx" <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.
PHP CODE
----------------
$conn = ociplogon("scott", "tiger", "ABCD.world");
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn,"BEGIN AUTO_CHARGE.EXP_RENEW_SUBSCR(:data);
end ;");
ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR);
ociexecute($stmt);
ociexecute($curs);
while (OCIFetchInto($curs,&$data)) {
$customer_id = $data[0];
$owner_name = $data[1];
$type = $data[2];
$code = $data[3];
.
.
.
}
Sorry but if you doesn't want to help him/her don't bother to
write your sarcastic's answer's.
Well said!
This is part of the reason perl is loosing ground to other languages like PHP.
Here we have a perfectly good opportunity to introduce someone to the wonders
of perl and we've thrown it away. The original poster will probably walk away
from all this thinking
"Perl? phew! no thanks!"
As far as offering a helpful answer, (to the original post) what you'll want to
do is check out the DBI and DBD modules at your friendly neighborhood CPAN
archive.
DBI is the modern way perl programs communicate with databases, DBI is a
generic interface. DBD is the actual database driver for it. (there is
one DBI and separate DBD's for each particular database.)
You'll find that with with the standard interface of DBI, porting your
application to other databases is a bit easier.
Do a 'perldoc DBI' for the details, it's quite easy once you get around to
understanding statement handles and connection handles. (these are a bit like
Resource handles of PHP)
You'll also want to glance over the DBD driver for oracle to find the connection
string details.
Jamie
--
http://www.geniegate.com Custom web programming
Perl * Java * UNIX User Management Solutions
.
- Follow-Ups:
- Re: Any good Perl coders out there?
- From: Keith Keller
- Re: Any good Perl coders out there?
- References:
- Any good Perl coders out there?
- From: amerar@xxxxxxx
- Re: Any good Perl coders out there?
- From: Timo Jokinen
- Any good Perl coders out there?
- Prev by Date: Re: regex question
- Next by Date: Re: I dotn understand this error
- Previous by thread: Re: Any good Perl coders out there?
- Next by thread: Re: Any good Perl coders out there?
- Index(es):
Relevant Pages
|
Loading