Re: [GENERAL] How to deal with NULL values on dynamic queries?

2010-05-06 Thread Tom Lane
Andre Lopes writes: > I have a query that some values could be NULL, how can I deal with this > problem? PG 8.4 and up have a function quote_nullable() that would do what I think you're looking for. On an older version, you could define such a function for yourself. rega

Re: [GENERAL] How to deal with NULL values on dynamic queries?

2010-05-06 Thread Kenichiro Tanaka
Hi Null + 1=null. and null + 'a' = null. I expect that pVAL_COMENT is null (as you say). === create test environment. === create table nulltest (col1 varchar(10),col2 varchar(10)); insert into nulltest (col1,col2) values ('A','B'); insert into nul

[GENERAL] How to deal with NULL values on dynamic queries?

2010-05-06 Thread Andre Lopes
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)