Subject | Re: [firebird-support] check for exist with assignment |
---|---|
Author | Ivan Přenosil |
Post date | 2013-11-10T20:36:38Z |
> On 11/10/2013 1:16 AM, Ivan Přenosil wrote:If no row is found, nothing is assigned, i.e. NEWID will keep its original value.
> >> Option 2:
> >> select ID from CITIES where CITY = :NEWCITY into :NEWID;
> >> if ( NEWID is not null ) then suspend;
> >> /* Do insert operation since nothing found */
> > Do not forget that this requires NEWID to be set to Null before calling select !
>
> After the select statement, if no row is found, what value will NEWID be
> if I haven't specifically assigned anything to it prior to the select?
All local variables - DECLARE VARIABLE ... - are initialized by NULL unless
you explicitly specify otherwise.
Ivan