Hi all,
I'm trying to supply two varchar values to a SQL statements by using bind_param(). The sql statement is not giving results. I even tried to pass values using execute(value1,value2) to SQL statement but it didn't work.
can anyone please help me in this. Your advice is greatly appreciated. Thanks!
use DBI;
my $dbh;
use DBI qw(:sql_types);
$dbh = DBI->connec('Dbname','usrname','passwd','Oracle', \%attr);
my $sth_LOG = $dbh->prepare(
qq{select num_org_mfg,cd_typ_evnt_dntm,num_rsn_dntm
from mfg_evnt.dntm_rsn_ulog
where num_org_mfg = 7664
and cd_typ_evnt_dntm ='DNTM'
and num_rsn_dntm = 2});
my $sth_DNTM = $dbh->prepare(qq{select num_org_mfg,nam_rsn_dntm
from mfg_evnt.dntm_rsn
and cd_typ_evnt_dntm= ?
and num_org_mfg = ?
});
if($DBI::errstr)
{ print "error in preparation ........\n"; }
$sth_LOG->execute();
if ($DBI::errstr) { print "error in sth_log execute\n"; }
($num_org, $cd_typ, $num_rsn) = $sth_LOG->fetchrow_array();
# binding parameters to sth_DNTM statememt
$sth_DNTM->bind_param(1,$cd_typ);
$sth_DNTM->bind_param(2,$num_org);
$sth_DNTM->execute();
@row = $sth->fetchrow_array();
print "@row\n";
$sth_LOG->finish;
$sth_DNTM->finish;
$dbh->disconnect;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.