Subject Re: [firebird-support] Re: How to drop stored procedure from another stored procedure ?
Author Helen Borrie
At 04:56 AM 8/09/2007, you wrote:
>Looks well but I get parsing error compiling it
>
>Invalid token.
>Dynamic SQL Error.
>SQL error code = -104.
>Token unknown - line 4, column 9.
>BLOCK.
>
>
>CREATE PROCEDURE DROP_PROC
>AS
>begin
> EXECUTE BLOCK

You can't use EXECUTE BLOCK in a stored procedure. You seem to have
misunderstood Milan's advice...the code inside an EXECUTE BLOCK is
like the code inside a s.p. - they are almost interchangeable. Use
EXECUTE BLOCK in dynamic SQL, use CREATE PROCEDURE to create a
permanent s.p. So:

CREATE PROCEDURE DROP_PROC
AS
begin
if (exists(select 1
from RDB$PROCEDURES where RDB$PROCEDURE_NAME = 'PROC'))
then
EXECUTE STATEMENT 'drop procedure PROC';
end

./hb