The problem is that I don't want them to be null. They come into the module as space filled, for some reason bind_param is converting them to nulls. At least I think so, or it's a surrounding quote issue. Either way I can't get the space filled field to remain that way through to the actual insert.
-----Original Message----- From: Barbara Lindsey [mailto:[EMAIL PROTECTED]] Sent: Monday, May 06, 2002 2:49 PM To: Tompkins, Creigh Cc: '[EMAIL PROTECTED]' Subject: Re: bind_param and space filled fields you could just check all your values for strlen or isset and assign NULL to the ones that should be prior to passing off to bind_param function. "Tompkins, Creigh" wrote: > > Help, > > I have a generic table wrapper that builds inserts on the fly using > bind_param. It works fine until it tries to insert a space filled character > variable into a NOT NULL varchar2 table column. > > It then produces the error: > > DBI Error string=ORA-01400: cannot insert NULL into > ("FACTORY"."MENUFILE"."PROGRAM_NAME") (DBD ERROR: OCIStmtExecute) > [/home/tompkic1/cvsco/factory/trunk/library/perl_modules/Schemas/Table_wrapp > er.pm] INSERT INTO FACTORY.MENUFILE ( > > Here's the bind_param statement: > > my $number = 0; > foreach my $key ( sort( keys( %{ $column_info_hash{$table_name} } ) ) ){ > $sth->bind_param( ++$number, $hashref->{$key} ); > } > > This only occurs if I use the bind_param method. If I hardcode the entire > insert statement and surround the varchar fields in single quotes it works > fine. > But I'm hoping to find an answer that will keep the concept of the generic > table wrapper alive. > > Any help would greatly appreciated. > > Thank you, > Creigh Tompkins > [EMAIL PROTECTED] > IMPORTANT NOTICE: The contents of this e-mail are confidential to the > ordinary user of the e-mail address to which it was addressed and may also > be privileged. If you are not the addressee of this e-mail you may not > copy, forward, disclose or otherwise use it or any part of it in any form > whatsoever. If you have received this e-mail in error please e-mail the > sender by replying to this message. -- Barbara E. Lindsey, Phone: (352) 392-5198 ext. 314 Fax: (352) 392-8162 "The road goes ever on and on. " - Bilbo Baggins IMPORTANT NOTICE: The contents of this e-mail are confidential to the ordinary user of the e-mail address to which it was addressed and may also be privileged. If you are not the addressee of this e-mail you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender by replying to this message.
