Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: perl script and Oracle

Re: perl script and Oracle

From: <csb_manian_at_my-dejanews.com>
Date: Thu, 06 May 1999 19:15:46 GMT
Message-ID: <7gspot$eh3$1@nnrp1.deja.com>


Hi,
Here is the sample code for executing stored procedure using perl script.

Note:NSL_GET_PASSWORD is the name of the stored procedure.


#!/usr/local/bin/perl -w
##############################################################################
##############################################################################
# FormMail Version 1.5
# Copyright 1996 Matt Wright mattw_at_misha.net
# Created 6/9/95 Last Modified 2/5/96
#
##############################################################################
# COPYRIGHT NOTICE
#
# Copyright 1996 Matthew M. Wright All Rights Reserved.
# FormMail may be used and modified free of charge by anyone so long as this
# copyright notice and the comments above remain intact. By using this
# code you agree to indemnify Matthew M. Wright from any liability that
# might arise from it's use.
# Selling the code for this program without prior written consent is #
# expressly forbidden. In other words, please ask first before you try and #
# make money off of my program. #
# Obtain permission before redistributing this software over the Internet or #
# in any other medium. In all cases copyright and header must remain intact #
##############################################################################

use CGI;
use CGI::Carp qw(fatalsToBrowser);
$q = new CGI;
@referers=('207.25.144.51');

print $q->header;
print "\n\nMessages - \n";

BEGIN{
$ENV{ORACLE_HOME}='/ans/pkg/oracle';
}
use DBI;

$dbh=DBI->connect('dbi:Oracle:','skandia/skandia_at_skandia','');

if (!defined($dbh)){
print "Unable to connect to database\n"; }
else
{
print "Connected to Database\n";
}

$sth=$dbh->prepare('BEGIN nsl_get_password(:1,:2,:3);END;'); print "Test procedure";

$sth->bind_param(1,$emailid);
$sth->bind_param_inout(2,\$userids,'2000');
$sth->bind_param_inout(3,\$pwds,'2000');
$rv=$sth->execute;

print "Username: $userids\n";
print " Password: $pwds\n";
$sth->finish;
$dbh->disconnect;
exit;

Try the same way and post your response to dejanews.

Thanks

Manian

In article <7g6tmm$g6n$1_at_sloth.swcp.com>,   elufker_at_swcp.com (Ed Lufker) wrote:

> Hi all:
>
> 	Can  perl script run or call an oracle procedure and also pass
> parameters to the procedure. Any examples of code would be great.
>
> thanks for any help here
> eddie lufker
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Received on Thu May 06 1999 - 14:15:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US