You need to bind the item to a SQL_CHAR type or DBI will try to insert a
null into the table.  I ran into this problem awhile back and it about
drove me insane trying to figure it out.

try this:
$sth->bind_parm($dbindex++, $pub, SQL_CHAR);

Gordon

-----Original Message-----
From: Duin, Harry [mailto:harry.duin@;bankofamerica.com]
Sent: Wednesday, November 13, 2002 4:15 PM
To: [EMAIL PROTECTED]
Subject: inserting a single space into a non NULL field aborts with
error


I have an Oracle field that has this constraint:

PUBLISHERID      VARCHAR2 (100)  DEFAULT ' ' NOT NULL,

In Perl I call bind_param as such:

$sth->bind_param($dbindex++, $pub);

where $pub is set to a single space.

Oracle reports this error:

DBD::Oracle::st execute failed: ORA-01400: cannot insert NULL into
("RPASS"."DOCUMENT"."PUBLISHERID") (DBD ERROR: OCIStmtExecute) at
mk_docs.pl
line 1249.

When I change $pub to a string with valid chars, then the error goes
away.
Anyone has any suggestions? I did verify that I can insert a single
space
via sqlplus.

thanks,

-----------------
Harry Duin (pronounced as hari [as in Hari Krishna] dine [as in eat
out])
[EMAIL PROTECTED] tel:(312) 974-6379 pgr:(630) 362-9981
GMI  IL1-231-18-32
Bank of America 231 S. LaSalle Street Chicago IL 60604

Reply via email to