For any kind of logic threatment in query I think that you can use
CASE/WHEN/END method (include WHERE clausule).
To make more simple your SQL, deal with null values using coalesce
function, like:
where (coalesce(myvalue,-1)>0).
2017-08-30 15:19 GMT-03:00 Luigi Siciliano luigi...@tiscalinet.it
> < snip>
> from
>
> PN_TESTA PNT
> JOIN PN_CORPO PNC on PNT.ID = PNC.PN_TESTA_ID
> WHERE
> PNC.CONTO_ID = :CONTO
>
> if :CLIENTE is not null then <-- *IS NOT ACCEPTED*
>
> AND IIF (PNC.CLIENTE_ID IS NOT NULL, PNC.CLIENTE_ID,
> PNC.FORNITORE_ID) = :CLIENTE)
>
Hallo,
I have a stored procedure that have two parameters: CONTO and CLIENTE
because there is two values for CONTO that needs CLIENTE parameters, all
other values of CONTO not needs CLIENTE.
I need to have a if statement in WHERE clause to add "AND IIF
(PNC.CLIENTE_ID IS NOT NULL,