| [reply] [d/l] [select] |
What other %ENV is there in Perl?
You could make a lexical named %ENV, and it would mask %main::ENV. That doesn't appear to be the case here, but that's another one.
| [reply] [d/l] [select] |
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 | [reply] |