CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Problem in Executing PL/SQL block with Perl

 



jessica_hynes
New User

Jul 9, 2007, 5:22 AM

Post #1 of 2 (943 views)
Problem in Executing PL/SQL block with Perl Can't Post

Hi All,

As I hv never used Oracle with Perl...I am unable to get the values which I
am fetching in PL/SQL variables..

Can anyone please look into this problem?

Here my code
------------------------------------------------------

#!/usr/bin/perl

use DBI qw(:sql_types);


$dbh=DBI->connect("$datasource","$user","$pwd");



my($input_booking_seq, $fax_header, $file_no,$input_print_rates, $myNoteId, $printer_name);



eval {

$sth = $dbh->prepare($sql = q{
DECLARE
user_id VARCHAR2(15);
input_booking_seq VARCHAR2(20);
fax_header VARCHAR2(10);
file_no VARCHAR2(15);
BEGIN

select user_id,passkey, '//FAX(fax=' || passkey1, passkey2
into user_id,input_booking_seq,fax_header,file_no
from edit_table
where edit_table.tag = 'BOOKING'
and edit_table.key = 'PRINT' and id=3;

END;
}) or die $dbh->errstr;


$sth->bind_param(":user_id",$user_id);
$sth->bind_param(":input_booking_seq",$input_booking_seq);
$sth->bind_param(":fax_header",$fax_header);
$sth->bind_param(":file_no",$file_no);

$sth->execute;

};


if($@){

print "Failed : $DBI::errstr \n";
$dbh->errstr;

}else{

print "Returned $user_id,$input_booking_seq,$fax_header,$file_no \n";

}

$dbh->disconnect;

--------------------------------------------------------------------------------------------

I want to see the values which I am fetching from select query..


(This post was edited by jessica_hynes on Jul 9, 2007, 5:27 AM)


jessica_hynes
New User

Jul 10, 2007, 2:59 AM

Post #2 of 2 (928 views)
Re: [jessica_hynes] Problem in Executing PL/SQL block with Perl [In reply to] Can't Post

Now I am able to get the values but I am not able to print those values my code Hi,I am trying to print the values in perl while working with oraclemy code is

----------------------------------------------------------------------------------------------
$sth = $dbh->prepare(q{

DECLARE

user_id VARCHAR2(50);
input_booking_seq VARCHAR2(50);
fax_header VARCHAR2(50);
file_no VARCHAR2(50);

BEGIN

select user_id,passkey, '//FAX(fax=' || passkey1, passkey2
into user_id,input_booking_seq,fax_header,file_no
from edit_table
where edit_table.tag = 'BOOKING'
and edit_table.key = 'PRINT' and passkey = '1533805';

dbms_output.put_line('The values are '||input_booking_seq);
END;
}) or die $dbh->errstr;

$dbh->func( 1000000, 'dbms_output_enable' );
$dbh->func( $values, 'dbms_output_put' );
$values = $dbh->func('dbms_output_get' );
$sth->execute;


print "$values \n";
----------------------------------------------------------------

But I am not getting any value

Please Suggest

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives