Subject | Re: Stored procedure, ExecSQL and Suspend |
---|---|
Author | Marco Menardi |
Post date | 2002-11-04T16:35:47Z |
--- In IBObjects@y..., Svein Erling Tysvaer <svein.erling.tysvaer@k...> wrote:
It means "check if exixts one row that, in addition to some other criteria, if calls GET_CONTO_DIFFERENZIA_GR with it's data has a 'S' as OUT_PC_DIFF_GR"
regards
Marco Menardi
> Marco,It's the EXISTS syntax. You don't have any row returned, it's only for syntax complinace. Ok, SELECT 1 works as well, but I prefer the general form.
>
> 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 simplyRight, but that table is a stored procedure, that returns a value (OUT_DIFFERENZIA) that needs to be tested.
> means that the right table has no relevance within an EXISTS.
It means "check if exixts one row that, in addition to some other criteria, if calls GET_CONTO_DIFFERENZIA_GR with it's data has a 'S' as OUT_PC_DIFF_GR"
>Yes, it is, but this is the simplest ;))
> Don't know if this helps at all, but simple code is normally a good way to
> avoid problems,
regards
Marco Menardi