Re: [firebird-support] Is it possible IF then statement in where clause?

2017-08-30 Thread hamacker sirhamac...@gmail.com [firebird-support]
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

Re: [firebird-support] Is it possible IF then statement in where clause?

2017-08-30 Thread setysvar setys...@gmail.com [firebird-support]
> < 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) >

[firebird-support] Is it possible IF then statement in where clause?

2017-08-30 Thread Luigi Siciliano luigi...@tiscalinet.it [firebird-support]
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,