Search code examples
oracle-databasevbscripthp-uft

[Microsoft][ODBC driver for Oracle][Oracle]ORA-00911 in VBScript


When I use the query directly it's works, but when I run in it with VBscript this error occurs.

The connection with de DB works.

global_OracleConn = Createobject("ADODB.Connection")

global_OracleConn.Open connectionString

query = "UPDATE DB.TabelX SET X_DT_ = SYSDATE + 360, "_
    &"X_Amount_MAX_ID = 100, X_Amount_IN_REQUEST = '1', X_NUM = 15000,"_
    &"X_VALUE_LIMIT = 15000, SCORE = 0, 
    &"WHERE ROW_ID IN (SELECT X_ULTIMA_ID FROM DB.TabelY "_
    &"WHERE OU_NUM IN ('"&varID&"'));" 

global_OracleConn.Execute(Query)

I tried use others breaklines or put all in one line, but the error still occurs.


Solution

  • There are several issues:

    1. Remove the semicolon at the end from your SQL string
    2. The quoting is wrong. You missed a double quote after SCORE = 0,
    3. Ancient Microsoft ODBC Driver for Oracle is deprecated for ages. Use the ODBC driver from Oracle
    4. Use prepared statement with bind parameters, i.e.