5

I'm running a PHP script that updates a table from an Oracle DB instance.

First, I receive an object with JSON:

[{
  "lot": "KLMHA17N9N00",
  "requestor": "B10078",
  "id": "FRESHLOT",
  "username": "B26696",
  "password": "B26696"
}, {
  "lot": "KLMHA17R1800",
  "requestor": "B10078",
  "id": "FRESHLOT"
}]

(This JSON is known to have no problems, since I've been using this in other projects.)

Then, I create the query after parsing the results to the $rmrid object:

$db_query = "update ao_lots 
                 set RMRID='".$rmrid->requestor."-".$rmrid->id."' 
               where ALOT_NUMBER='".$rmrid->lot."';";

If I echo the query, I get this:

update ao_lots 
   set RMRID='B10078-FRESHLOT' 
 where ALOT_NUMBER='KLMHA17N9N00';

I don't see any problems here, but when I execute the query, I get this warning and nothing is updated:

WARNING: oci_execute() [function.oci-execute]: ORA-00911: invalid character

I did some searching on that error code, but I couldn't fix it with the info that I found.

Any suggestions would be greatly appreciated.

srborlongan
  • 4,460
  • 4
  • 26
  • 33
Arturo
  • 1,123
  • 3
  • 19
  • 33
  • 1
    Pls update the question with the output from `DESCRIBE AO_LOTS` – OMG Ponies Aug 19 '10 at 16:29
  • It would also help if you could try to run the sql that you've generated from SQL*Plus and see if you have the same error. You can roll back the update if there is no statement error. – dpbradley Aug 19 '10 at 17:00
  • I ran the statement on SQL*Plus and it runs with no problems, I've been doing it this way long ago but I want to automate the process now – Arturo Aug 20 '10 at 00:56

1 Answers1

15

The semi-colon isn't needed at the end of the SQL statement.

It is used by SQL*Plus and most other tools to indicate "I've finished writing the statement, now go execute it"

Gary Myers
  • 34,963
  • 3
  • 49
  • 74