Subject Re: [firebird-support] Writing A Stored Procedure ??
Author Paul Vinkenoog
Hi Anand,

> begin
> /* Procedure Text */
> SELECT COUNT(*) FROM CC_USERS WHERE DR_ID=:"str_DR_ID" AND
> CC_USER=:"int_USER_ID" into :tmp_count

Add a semicolon after the above line - this is why the parser doesn't
recognize the IF token.

Then, as Alexander said, the boolean expression in an IF clause *must*
be between (). And tmp_count doesn't need the colon here:

> IF :tmp_count = 0 then
> INSERT INTO CC_USERS VALUES (:"str_DR_ID", :"int_USER_ID")

Also needs ';'

> suspend;
> end

Last advice: follow Alexander's advice about the EXISTS option ;-)

Greetings,
Paul