Subject Re: [IBO] Stored procedure, ExecSQL and Suspend
Author Svein Erling Tysvaer
Marco,

At 13:30 04.11.2002 +0000, you wrote:
> IF (EXISTS (SELECT * FROM PIANO_CONTI
> LEFT JOIN GET_CONTO_DIFFERENZIA_GR(PIANO_CONTI.CONTO_ID,
> :IN_CONDOMINIO_ID, :IN_ESERCIZIO_ID,
>
>PIANO_CONTI.DIFFERENZIA_GRUPPO_RIPARTO) ON (1=1)
> WHERE (CONDOMINIO_ID = :IN_CONDOMINIO_ID) AND
> (ESERCIZIO_ID = :IN_ESERCIZIO_ID) AND
> (GET_CONTO_DIFFERENZIA_GR.OUT_DIFFERENZIA='S'))) THEN
> OUT_PC_DIFF_GR = 'S';

this bit sounds strange to me. Couldn't this be simplified to

IF (EXISTS (SELECT 1 FROM PIANO_CONTI
WHERE (CONDOMINIO_ID = :IN_CONDOMINIO_ID) AND
(ESERCIZIO_ID = :IN_ESERCIZIO_ID))) THEN
OUT_PC_DIFF_GR = 'S';

There is no need to return all rows within an EXISTS and a left join simply
means that the right table has no relevance within an EXISTS.

Don't know if this helps at all, but simple code is normally a good way to
avoid problems,
Set