below is my code
#!/usr/bin/perl
use DBI;
$ENV{'LD_LIBRARY_PATH'}= "/opt/instantclient_10_2/";
$ENV{'ORACLE_HOME'}= "/opt/instantclient_10_2/";
$database = "idm";
$username = "idm";
$password = "idm";
$hostname = "host";
$output = &connectCBMS(900010);
print $output;
sub connectCBMS {
print "Connecting to Database for user $staffcode";
$db = DBI->connect("DBI:Oracle:host=$hostname;sid=$database",$username,$password);
unless($db) {
print "(ERROR) Failed to connect to $hostname.";
return;
}
my ($staffcode) = @_;
# Execute a Query
my $sql = qq{ SELECT REGISTRATIONDAY FROM CBMS WHERE STAFFCODE = ? };
my $sth = $db->prepare( $sql );
print $staffcode;
$sth->bind_param( 1, $staffcode );
$sth->execute();
while ( $row = $sth->fetchrow_array()) {
if (!$row) {
return;
}
else {
return ($row);
}
}
$sth->finish();
$db->disconnect();
return;
}
Thanks
Sri In reply to Re^2: PATH is not setting - PERL
by srini_sun
in thread PATH is not setting - PERL
by srini_sun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |