Home php Error in Request: ORA-00933: SQL Command Not Properly Ended

Error in Request: ORA-00933: SQL Command Not Properly Ended

Author

Date

Category

When a selection of a request to the Oracle database using PHP, this result is obtained:

update mytest2 set description = 'bumvo',
Name = 'ris'
Where Description = 'BMV';
Update MYTEST2 SET Description = 'BRIZ',
Name = 'Gilio'
Where description = 'briz';

But it is not executed and returns a mistake:

ORA-00933: SQL Command Not Properly Ended

Please tell me where I could allow an error?

Function for query formation:

// Edit table
Public Static Function EditTable () {
  //
  //
  // $ id = (int) $ _ post ['id'];
  // $ Namesc - Column Name
  // $ Namesc = $ _post ['id_name'];
  // // New meaning
  // $ text = $ _post ['new_val'];
  $ testarray = [];
  If (ISset ($ _ POST ['Oll_Items'])) {
    // New row values
    $ allirems = $ _post ['oll_items'];
    // Column and Values ​​will be used in the indentator cochier
    $ columnandvalue = $ _post ['clumn_value'];
    // Name Table
    $ table = $ _post ['cr_table'];
    // Table headers
    // $ headertable = $ _post ['cr_header'];
    // Connect to the database
    Global $ Conn;
    $ Query = "Update $ Table Set";
    $ Query2 = "Update $ Table Set";
    $ result = "";
    // Changing data in the table
    Foreach ($ allirems as $ item) {
      Foreach ($ item as $ key = & gt; $ value) {
        If (! Next ($ Item)) {
          $ Query. = $ Key. "= \". $ Value. "\" \ n ";
        } else {
          $ Query. = $ Key. "= \". $ Value. "\", \ n ";
        }
      }
      $ Query. = "WHERE";
      Foreach ($ ColumnandValue AS $ i) {
        Foreach ($ I AS $ Key = & GT; $ Value) {
            $ Query. = "$ Key = \" $ Value \ "";
        }
        array_shift ($ columnandvalue);
        Break;
      }
      // $ Result. = $ Query. "; \ n";
      // $ result = str_replace ("'",' ', $ result);
      // $ result = str_replace ('"'," '", $ result);
      $ Query = Str_replace ("'",' ', $ Query);
      $ Query = STR_REPLACE ('"'," '", $ Query);
      // Return $ Query;
      $ STIP = OCI_PARSE ($ Conn, $ Query);
      $ res = oci_execute ($ STIP);
      $ Query = "";
      $ Query = $ Query2;
}

Completion in SQL * Plus:

SQL * Plus: Release 12.1.0.2.0 Production on Tue Har 29 10:44:03 2016
Copyright (c) 1982, 2014, Oracle. All Rights Reserved.
ENTER USER-NAAE: System ENTER PASSWORD:
Last Successful Login Tiae: Tue Har 29 2016 16:38:47 403: 00 Connected to:
Oracle Oatabase 12C Standard Edition Release 12.1.0.2.0 - 64bit Production
SQL & GT; Update HVTEST2 SET Description = 'AAA', name = 'BBB' WHERE description = 'CCC'; Upoate Hytest2 Set Description = 'Briz ", name =' Gilio 'Where Descripti on =' briz ';
Update Hytest2 Set Description = 'AAA', name = 'BBB' WHERE Description = * 6YW V '; Upoate HVTEST2 SET Description =' Briz ', name =' Gilio 'Where Description = "Briz"
   *
ERROR AT LINE 1:
ORA-00933: SQL Coawiand Not Properly Ended
SQL & GT; _

Answer 1, Authority 100%

Very frequent misconception about the “point point” (; ) and the associated errors:

ORA-00933: SQL Command Not Properly Ended

What about this symbol is told in wiki :

SQL States ALSO INCLUDE THE SEMICOLON (“;”) Statement Terminator.
Though Not Required on Every Platform , IT IS Defined As A Standard Part of the SQL Grammar.

Oracle SQL This is just that platform that this item of the standard for historically established reasons ignores. That is, if for example, compared with some other Yaps, then the line of code:

int i = 0; String S = "ABC";

contains two completed expressions including characters; , then a valid expression:

select some_col from some_table;

ends the last symbol to ; . The symbol; is an indication of the client program or library, send the entire text of the query to a comma point SQL parser to the database server.

In other words, the symbol; is invalid in SQL Oracle database syntax. If it meets when PARSING SQL request, this will lead to the above mentioned or other errors.

Conclusion, you can not do:

sql & gt; SELECT 1 From Dual; SELECT 2 from dual;
SELECT 1 From Dual; SELECT 2 From Dual
         *
ERROR AT LINE 1:
ORA-00933: SQL COMMAND NOT PROPERLY Ended

Please note how the client program “understood” entered commands: the last ; Remote and the text of the request from ; In the middle sent a database server as one request.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions