How to deal with NULL values on dynamic queries? - Mailing list pgsql-general

From Andre Lopes
Subject How to deal with NULL values on dynamic queries?
Date
Msg-id g2y18f98e681005061602i66bb54bdifa504af74c0028@mail.gmail.com
Whole thread Raw
Responses Re: How to deal with NULL values on dynamic queries?  (Kenichiro Tanaka <ketanaka@ashisuto.co.jp>)
Re: How to deal with NULL values on dynamic queries?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi,

I have a query that some values could be NULL, how can I deal with this problem?

[code]
  EXECUTE 'INSERT INTO '
        || quote_ident(pNOME_VIEW)
        || '('
        || quote_ident(pCHAVE_1)
        || ', DAT_INICIO, DAT_FIM, COMENT) values ('
        || quote_literal(pVAL_CHAVE_1)
        || ', '
        || quote_literal(pVAL_CHAVE_2)
        || ', '
        || quote_literal(pVAL_CAMPO1)
        || ', '
        || quote_literal(pVAL_COMENT)
        || ')';
[/code]

The variable pVAL_COMENT could be NULL or have a value. How can I deal with this?

Sorry the bad english.

Best Regards,


pgsql-general by date:

Previous
From: Christophe Pettus
Date:
Subject: 02/09 SFPUG meeting, "Hot Standby and Streaming Replication," video now available
Next
From: Bryan Murphy
Date:
Subject: missing chunk number 0 for toast value 25693266 in pg_toast_25497233