On 10-11-2013 07:31, Daniel L. Miller wrote:
> Building a procedure - why is this rejected:
>
> if ( exists( select ID from CITIES where CITY = :NEWCITY into :NEWID ) )
> then begin
>         suspend;
> end
>
> the error is on the 'into' word
>
> but this is accepted:
>
> if ( exists( select ID from CITIES where CITY = :NEWCITY ) ) then begin
>         select ID from CITIES where CITY = :NEWCITY into :NEWID;
>         suspend;
> end
>

The Firebird syntax doesn't allow an INTO in this context. Technically 
Firebird has two selects, one with the INTO clause and one without. The 
SELECT with INTO clause is only allowed in PSQL as a separate statement, 
or as part of a FOR SELECT ... DO.

An EXISTS only allows a 'normal' select (that is: without an INTO clause).

Mark
-- 
Mark Rotteveel

Reply via email to