OCI: input bind for a NOT NULL char-column

From: (wrong string) é Hartmann <andrehartmann_at_hotmail.com>
Date: Mon, 11 Feb 2002 18:35:17 +0100
Message-ID: <a48vcm$bi3$1_at_crusher.de.colt.net>



Hi there,

  I have the following strange behaviour when I try to insert CHR-values into a NOT NULL chr column:

  • created table with

    create table abc (test char not null)

  ... works fine.
* inserted something with:

    insert into abc values(' ')

  ... works fine.

  • then executed

    insert into abc values(?)

   .. and bind ? to ' ':

  char* pValue = new char;
  *pValue = ' ';

 swdReturnCode = OCIBindByPos (
(OCIStmt*) pOCIStatement,
(OCIBind**) &pBindHandle,
(OCIError*) pConnection->getOCIError(),
(ub4) 1,
(dvoid*) pValue,
(sb4) (pValue == NULL) ? 0 : 1,
(ub2) SQLT_CHR,
(dvoid*) NULL,
(ub2*) NULL,
(ub2*) NULL,
(ub4) NULL,
(ub4*) NULL,
(ub4) OCI_DEFAULT

 );

 ... now when I OCIExecute, i get:

ORA-01400: cannot insert NULL into ("<user>"."ABC"."TEST")

.. why is this ??? why is my ' ' converted to an empty string which equals NULL ?????? Any help ? Is there some magic removing blanks in OCI ????

Andre
:( Received on Mon Feb 11 2002 - 18:35:17 CET

Original text of this message