My Oracle Support Banner

Calling the setNull Method of the OCCI Statement Class Fails With ORA-32158 invalid type (Doc ID 289986.1)

Last updated on APRIL 21, 2022

Applies to:

Oracle Database - Enterprise Edition - Version and later
Information in this document applies to any platform.


 A call to the setNull method of the statement class to set a VARCHAR2 bind variable to null fails with the following error:

ORA-32158 invalid type

The code executing that results in the error is:

void insertBind (int c1, string c2)
string sqlStmt = "INSERT INTO author_tab VALUES (:x, :y)";
stmt=conn->createStatement (sqlStmt);
stmt->setInt (1, c1);

// This is the line of code that returns an ora-32158 invalid type passed
stmt->setNull (2, OCCI_SQLT_CHR);

stmt->executeUpdate ();
cout << "insert - Success" << endl;
}catch(SQLException ex)
cout<<"Exception thrown for insertBind"< cout<<"Error number: "<< ex.getErrorCode() << endl;
cout< }

conn->terminateStatement (stmt);




To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.