Its in the fine manual (perldoc DBI).  If this is unclear, please submit a
suggestion for improvement.

B<Null Values>

Undefined values, or C<undef>, can be used to indicate null values.
However, care must be taken in the particular case of trying to use
null values to qualify a C<SELECT> statement. Consider:

  SELECT description FROM products WHERE product_code = ?

Binding an C<undef> (NULL) to the placeholder will I<not> select rows
which have a NULL C<product_code>! Refer to the SQL manual for your database
engine or any SQL book for the reasons for this.  To explicitly select
NULLs you have to say "C<WHERE product_code IS NULL>" and to make that
general you have to say:

  ... WHERE (product_code = ? OR (? IS NULL AND product_code IS NULL))

and bind the same value to both placeholders.

--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
----- Original Message -----
From: "Kevin Cornmell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 10, 2001 03:18
Subject: how do I insert a null value into an Ingres table ?


> Dear all,
>
> I need to select * from x, and then insert into y (an identical table on
> another database), nullvalues are
> causing me grief...
>
> Can somebody explain if you can do this with placeholders. ( if at all ).
>
> The message "Sorry NULLS not allowed unless TYPE defined" is trying to
tell
> me something,
> do I just need to define a TYPE, how do I do that ?
>
> regards
>
> Kevin
>
> " The sadder but wiser Perl for me...  "
>
> Production Services - Pre-Production Support Team
> Ingres DBA
> UK
>
>
>
>
****************************************************************************
*******
> The contents of, and the information contained in this email and any files
transmitted
> with it are confidential and legally privileged, and are sent for the
personal attention
> of the addressee(s). If you are not the intended addressee, any use,
disclosure or
> copying of this document is unauthorised.
>
> Thank you
> NTL
>
****************************************************************************
*******
>

Reply via email to