Subject | Re: [firebird-support] How to drop stored procedure from another stored procedure ? |
---|---|
Author | Helen Borrie |
Post date | 2007-09-06T15:04:21Z |
At 11:05 PM 6/09/2007, you wrote:
Subject: How to drop stored procedure from another stored procedure ?
Let's say I don't know is there in the database such procedure as
PROC. I'd like to check it and if it is there to drop it. I tried
something like this but I got "Parsing error"
PSQL is designed so that you cannot execute *any* DDL statements from
a stored procedure. Having database objects that can create, alter
or destroy other database objects is not exactly healthy for the
consistency tennet of database engine design.
However, since Firebird 1.5, you can achieve this if you really
insist on it (unwisely) by using EXECUTE STATEMENT. Briefly,
construct the DDL statement as a string inside the SP and pass the
string to an EXECUTE STATEMENT statement's argument. Documented in
the v.1.5.4 release notes, which you can download from the website
via the documentation index.
not designed to be changed by humans at all. Some third-party tools
mess around with them but you'd better be sure that the people who
wrote the tool know exactly what they are doing.
./heLen
Subject: How to drop stored procedure from another stored procedure ?
Let's say I don't know is there in the database such procedure as
PROC. I'd like to check it and if it is there to drop it. I tried
something like this but I got "Parsing error"
PSQL is designed so that you cannot execute *any* DDL statements from
a stored procedure. Having database objects that can create, alter
or destroy other database objects is not exactly healthy for the
consistency tennet of database engine design.
However, since Firebird 1.5, you can achieve this if you really
insist on it (unwisely) by using EXECUTE STATEMENT. Briefly,
construct the DDL statement as a string inside the SP and pass the
string to an EXECUTE STATEMENT statement's argument. Documented in
the v.1.5.4 release notes, which you can download from the website
via the documentation index.
> beginDefinitely not. Never do it. The system tables and their data are
> select count(*) from RDB$PROCEDURES where RDB$PROCEDURE_NAME = 'PROC'
> into :OK;
> if (:OK = 1) then
> begin
> DROP PROCEDURE PROC;
> end
> end
>
> BTW
> DROP PROCEDURE PROC
> is the same as
> delete from RDB$PROCEDURES where RDB$PROCEDURE_NAME = 'PROC' ??
not designed to be changed by humans at all. Some third-party tools
mess around with them but you'd better be sure that the people who
wrote the tool know exactly what they are doing.
./heLen