How to execute a selected statement?

Why wouldn't an otherwise bug-less SQL statement execute on oci_excute()?

  • I've some PHP code writing to an Oracle database via OCI8  library. I have a insert statement which wouldn't execute programmatically- if I print out the statement and run it via SquirrelSQL  it would insert the data successfully. I have delete and select  statement elsewhere in the code via $conn which work perfectly. What can be the  issue? And as I said if I print   $om_query and run manually it inserts successfully. I'm not getting any  other errors. $om_query = "INSERT INTO DB.TABLE(R1,R2) VALUES(V1,V2)"; $s2 = oci_parse($conn, $om_query); $qs = oci_execute($s2); oci_commit($conn); if(!$qs){ $ma = oci_error(); $failedqueries .= '<br /><br />MAINQ: ' . $om_query . '<br /><b>OCI_ERROR_MSG: </b>' . $ma['message']; } oci_error() doesn't append anything useful. Same question asked on StackOverflow: http://stackoverflow.com/questions/11271762/why-wouldnt-a-perfect-sql-statement-execute-on-oci-excute

  • Answer:

    Check if there are any date(or similar specially formatted) fields. Try running the query without them. Some formats are supported by external clients but not OCI8 execute functions.

Anonymous at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.