Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Perl code example
> I'm looking for a Perl example passing parameters.
>
> The code below has the userids and passwords hardcoded in clear text in
> the system line, parms 3 and 5 (five lines from the bottom), and the
> Oracle sid is hardcoded also. The code has to be changed to 1) read
> .pwd1 and .pwd2 files containing the passwords, and set a literal for the
> SID and substitute it at in the code.
>
> I'm not a Perl coder, and would appreciate any information, hints, or
> links to the manual.
Prepared queries can use placeholders (?) in the SQL. You can start out with something like:
my $dbh = DBI->connect( %connect_args );
...
my $sth = $dbh->prepare( 'select blah blah blah where foo = ?' );
...
if( $sth->execute( $value_for_foo_here ) {
my $result = $sth->fetchall_arrayref;
}
...
This would avoid all hard-coding and leave you with a re-usable $sth.
Try "perldoc DBI" as a good starting place for info on DBI.
You might also want to check out the dbi mailing list or O'Reilly Press' DBI manual.
sl
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: lembark_at_wrkhors.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Tue Sep 18 2001 - 11:34:20 CDT
![]() |
![]() |