Search Postgresql Archives

quoting values magic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Assume I have an UPDATE statement that looks like

  UPDATE foo
    SET
      pattern = '$pattern',
      shape   = '$shape',
      length  = $length,
      comment = '$comment'
    WHERE foo_id = $foo_id

and length is defined as NUMERIC.  Is there any kind of magic that
would allow me to use the SQL above as is even if $length is not
defined?  In other words, I'd like to avoid having to modify the SQL
to include or not include "length = $length" based on whether or not
$length is defined as it's acceptable for it to be NULL in foo.

I can't say "length = '$length'" as '' is not valid input for NUMERIC.

Hope that makes sense?

Thanks.

-- 
Brandon

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux