in reply to Re: DBI Inserting undef as literal string 'null'
in thread DBI Inserting undef as literal string 'null'

Thanks for your help!

I should have been more clear. I'm seeing the literal string when I do a select in the database. (Before anyone asks it's not just a different font or something. SELECT * FROM table_name WHERE field IS NULL does not work. It's actually a string with the value 'null'. I've inserted NULL values into the table manually and they work fine.)

I dumped the bound parameters as you suggested (see below). Values being set to undef is what I want, right?

$VAR1 = { '11' => '117082.50', '7' => '116500.00', '2' => '0028363075', '17' => '.0050000', '1' => '08/31/09', '18' => '09-01-09', '16' => '.0650000', '13' => undef, '6' => '462.76', '3' => '1709777884', '9' => '48.54', '12' => undef, '14' => undef, '15' => '736.36', '8' => '631.04', '4' => '08-26-09', '10' => '582.50', '5' => '1' };

Replies are listed 'Best First'.
Re^3: DBI Inserting undef as literal string 'null'
by mje (Curate) on Feb 24, 2010 at 08:45 UTC

    Assuming parameters 13, 12 and 14 coincide with the columns you expect to see NULL in then this looks right. Just make sure you are actually inserting into the column you expect to see NULL in as if you omit the column it may have a default of "null" - you'd have to check your schema for that.

    Other than that all I can suggest is you enable DBI tracing and assuming you are using DBD::ODBC add the following to the start of your script:

    use DBD::ODBC; DBI->trace(DBD::ODBC->parse_trace_flags('odbcconnection|odbcunicode' +));

    then set trace level 15 on your connection handle immediately after the connect or run with DBI_TRACE=15=x.log. See DBD::ODBC Tracing and DBI Tracing.