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, PNC.CLIENTE_ID, PNC.FORNITORE_ID) = 
:CLIENTE)" clause but it is not accepted, see:

I others word the "AND IIF (PNC.CLIENTE_ID IS NOT NULL, PNC.CLIENTE_ID, 
PNC.FORNITORE_ID) = :CLIENTE)" will execute only for the two values of 
CONTO.

< 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)

<snip>

There's a solution?

Thanks.

-- 

Luigi Siciliano
--------------------------



------------------------------------

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

Reply via email to