Thread

Posted on Tue Oct 23 09:24:11 2007 by smutel
Problem when prepare request (wildcard added)
Hello,

I have a problem with DBD-oracle but I don't know if it is a DBD-oracle problem or a problem with my oracle client configuration.

I use :
- Fedora Core 7
- Oracle Client 10.2.0.3-1
- DBD-Oracle-1.19
- Perl 5.8.8

export ORACLE_HOME=/usr/lib/oracle/10.2.0.3/client
export TNS_ADMIN=$ORACLE_HOME

sqlnet.ora :
NAMES.DIRECTORY_PATH= (TNSNAMES)

In my script (in fact check_ora_table_space.pl nagios script) :

my $dbh = DBI->connect( "dbi:Oracle:host=$host;port=$port;sid=$sid", $dbuser, $dbpass, { PrintError + => 0, AutoCommit => 1, RaiseError => 0 } ) || &error ("cannot connect to $dbname: $DBI::errstr\n"); $sth = $dbh->prepare(q{SELECT tablespace_name, SUM(BYTES)/1024/1024 FreeSpace FROM dba_free_space g +roup by tablespace_name}) || &error("Cannot prepare request : $DBI::errstr\n"); $sth->execute || &error("Cannot execute request : $DBI::errstr\n");


Result :

Cannot prepare request : ORA-00942: table or view does not exist (DBD ERROR: error possibly near <* +> indicator at char 60 in 'SELECT tablespace_name, SUM(BYTES)/1024/1024 FreeSpace FROM <*>dba_free +_space group by tablespace_name')


I don't know why <*> is added to the request ?

Thanks for your help.
Direct Responses: 6404 | Write a response
Posted on Tue Nov 6 22:32:08 2007 by mthurn in response to 6311
Re: Problem when prepare request (wildcard added)
Uhhh, that's just added by Oracle to show you where the error is in your SQL statement. Perl did not send the <*> to Oracle, Oracle is sending it back to you.
Direct Responses: 6414 | Write a response
Posted on Wed Nov 7 18:57:21 2007 by byterock in response to 6404
Re: Problem when prepare request (wildcard added)
Yep that what it is. The problem with you SQL is you forgot to put sys. in front of the table name it think
Write a response