I believe keszler is correct: you will not be able to insert NULL with the undef mechanism using an interpolated string. You can try setting $Ids->{Cluster} using a string literal;

$Ids->{Cluster} = 'NULL'

but string interpolation in general is iffy for writing a SQL query. It is better to use bound parameters: they're easier to get right, and they're safer, security-wise. See DBI->bind_param() for an explanation and example.

There are other problems, however. You have not shown how $dc_id and $cluster_id acquire their values. Are you completely certain they're set to what you think they are?

Also, the table definition for Hosts.Cluster_ID does not explicitly say the column is nullable. Are you completely certain of the default?

--
Your left-hand veeblefetzer is calibrated to the wrong Frammistan coefficient. Pass me that finklegruber.


In reply to Re^2: How to insert a NULL value into a table!! by misterwhipple
in thread How to insert a NULL value into a table!! by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.