I am connecting oracle DB and fetching a clomun value from a VIEW usi
+ng select query.
But I am getting the below error
"Table or view does not exit"
But the same query if I execute from a SQLPLUS, it works fine.
What I am doing wrong ? Is there a kind of privilege issue?
Thanks
Suriya
#!/usr/bin/perl
BEGIN {
unless ($ENV{BEGIN_BLOCK}) {
$ENV{ORACLE_HOME} = "/usr/local/lib/instantclient_10_2/";
$ENV{LD_LIBRARY_PATH} = "/usr/local/lib/instantclient_10_2/";
#ENV{TNS_ADMIN} = '/common/oracle/env';
$ENV{BEGIN_BLOCK} = 1;
exec 'env', $^X, $0, @ARGV;
}
}
use DBI;
$database = "idm";
$username = "idm";
$password = "idm";
$hostname = "10.14.8.21";
$db = DBI->connect("DBI:Oracle:host=$hostname;sid=$database",$username
+,$password);
unless($db) {
print "(ERROR) Failed to connect to $hostname.";
exit(1);
}
my ($staffcode) = @_;
# Execute a Query
my $sql = qq{ SELECT REGISTRATIONDAY FROM FORMVIEW WHERE STAFFCODE = ?
+ };
my $sth = $db->prepare( $sql );
$sth->bind_param( 1, $staffcode );
$sth->execute();
while ( $row = $sth->fetchrow_array()) {
if (!$row) {
print "no";
}
else {
print $row;
}
}
$sth->finish();
$db->disconnect();
}