> On 11/10/2013 1:16 AM, Ivan Přenosil wrote: > >> 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?
If no row is found, nothing is assigned, i.e. NEWID will keep its original value. All local variables - DECLARE VARIABLE ... - are initialized by NULL unless you explicitly specify otherwise. Ivan
