Hopefully a simple question.
error_reporting(E_ALL);
ini_set('display_errors', '1');
$c = oci_connect('whatmyusrnameis', 'whatmypwdis', 'host');
if ($c) {
echo 'connection';
}
$s = oci_parse($c, 'select * from mantis_bug_table');
oci_execute($s);
The following results in
Warning oci_execute(): ORA-00942: table or view does not exist
but the connection doesn't result in any errors and the DB table does exist and it is not empty.
Any ideas??? Thank you :).
So how can we solve it? You can easily solve this error either by creating the missing object (by object I mean a table, view, synonym or a cluster) or by importing it from another source into your schema.
This error will occur when the table name prefix is not specified for the table. The Table name prefix is a requirement for loading in bulk mode for Oracle 9i. 1) For Solution, enter CR with a Workaround if a direct Solution is not available.
Typically this has one of four possible problems
select * from DB_USER.mantis_bug_table
(See Justin Cave's answer regarding SYNONYMs if you don't want qualify the tablename)You can diagnose this by running the following
SELECT * FROM ALL_TABLES WHERE UPPER(table_name) = 'MANTIS_BUG_TABLE'
MANTIS_BUG_TABLE
table?If the table is owned by some other user, you could try fully qualifying the table name
$s = oci_parse($c, 'select * from owner_of_table.mantis_bug_table');
If the user your PHP script is using doesn't have access to the table, you'll need a DBA or the owner of the table to
GRANT SELECT ON owner_of_table.mantis_bug_table
TO whatmyusernameis;
If you have access to the table and fully qualifying the table name works but you don't want to have to fully qualify the table name every time, you can create a synonym
CREATE [PUBLIC] SYNONYM mantis_bug_table
FOR owner_of_table.mantis_bug_table
A public synonym allows all users with access to the table to reference it without using a fully qualified name. A private synonym allows just the owner of the synonym (i.e. whatmyusernameis) to reference the table without a fully qualified table name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With