Subject RE: [firebird-support] Problem with a condition...
Author Thomas Steinmaurer
Hi,

> I'm trying to test if a name is known in a table before executing
> some operation or to raise an exception, but it seems i've done
> something wrong, let's have a look :
>
> ...
> begin
> if (:s_name not in (select pilotename from pilote)) then
> begin
> exception data_error;
> end
> else
> begin
> ...
>
>
> I have : "subselect illegal in this context", can you tell me why,
> please ?

Try:

begin
if (not exists(select 1 from pilote where pilotename = :s_name)) then
begin
exception data_error;
end else
...

end



HTH,
Thomas Steinmaurer
LogManager Serie - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com