Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> OCI: input bind for a NOT NULL char-column

OCI: input bind for a NOT NULL char-column

From: André Hartmann <andrehartmann_at_hotmail.com>
Date: Mon, 11 Feb 2002 18:35:17 +0100
Message-ID: <a48vcm$bi3$1@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:

    create table abc (test char not null)

  ... works fine.
* inserted something with:

    insert into abc values(' ')

  ... works fine.

    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 - 11:35:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US