0

Im connecting to an ORACLE 11 DB with PHP. Here is the code to do the connection:

$con = oci_connect($user, $pass, $server."/".$database, $charset);

Once i´ve connected, im able to execute queries like this:

  $sql = "SELECT * FROM SCHEMANAME.table";
  $stid = oci_parse($con, $sql);
  oci_execute($stid);

Everything works OK, but if i don´t put the SCHEMANAME before the tables name i got an error, indicating that "ORA-00942: table or view does not exists..."

Is there any way to set a default schema and avoid to use the schemaname in every query?.

Thanks in advance.

Tommy
  • 391
  • 1
  • 2
  • 20
  • Create a Public Synonym TABLENAME, with the SCHEMA.TABLENAME , so you query using synonym ! – Maheswaran Ravisankar Jan 28 '14 at 12:50
  • If i understand your answer im going to need one synonym per table, right? Im looking for a general and clear solution if exists :D – Tommy Jan 28 '14 at 12:54
  • 1
    Your answer is [here](http://stackoverflow.com/questions/6955814/how-to-grant-user-privilege-on-specific-schema) .So until you do this, or use the Schema user id itself. It is not possible! – Maheswaran Ravisankar Jan 28 '14 at 13:01

0 Answers0