How to deal with NULL values on dynamic queries?

From: Andre Lopes <lopes80andre(at)gmail(dot)com>
To: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: How to deal with NULL values on dynamic queries?
Date: 2010-05-06 23:02:57
Message-ID: g2y18f98e681005061602i66bb54bdifa504af74c0028@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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,

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bryan Murphy 2010-05-06 23:24:41 missing chunk number 0 for toast value 25693266 in pg_toast_25497233
Previous Message Christophe Pettus 2010-05-06 21:24:49 02/09 SFPUG meeting, "Hot Standby and Streaming Replication, " video now available