> select codigo, nome from tcliente where ativo = 1 and empresa between 
> coalesce($1,0) and coalesce($1,999)

Cara... não achei legal essa. Esses casos eu trabalho da seguinte forma:

select codigo, nome from tcliente where ativo = 1 and ((empresa = $1)
or ($1 is null))

-- 
Marcone Peres - DBA
http://www.linkedin.com/in/marconeperes
@marconeperes
(61) 8146-0028
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a