Subject | Re: stored procedure to GRANT priveledges not working |
---|---|
Author | Adam |
Post date | 2006-06-15T01:28:37Z |
--- In firebird-support@yahoogroups.com, "robertgilland"
<robert_gilland@...> wrote:
It is not normally recommended to do DDL inside the same transaction
as DML. The only way you can do it is to use the execute statement
syntax (see release notes).
Adam
<robert_gilland@...> wrote:
>Grant is not DML! It is DDL; like CREATE TABLE or DROP PROCEDURE etc.
> I have written this stored proc.
>
> SET TERM #;
> CREATE PROCEDURE PROC_ADDUSER
> ( USERORROLE CHAR(31)) AS
> DECLARE VARIABLE THERELNAME CHAR(80);
>
> BEGIN
> FOR SELECT RDB$RELATION_NAME FROM RDB$RELATIONS
> WHERE RDB$RELATION_NAME NOT LIKE 'RDB$%'
> ORDER BY RDB$RELATION_NAME INTO :THERELNAME
> DO
> BEGIN
> GRANT ALL ON :THERELNAME TO :USERORROLE;
> END
> END#
> SET TERM ;
>
> When I run in IBOConsole I get:
>
> ISC ERROR CODE:335544569
>
> ISC ERROR MESSAGE:
> Dynamic SQL Error
> SQL error code = -104
> Token unknown - line 10, column 6
> GRANT
>
>
> What is wrong with this?
It is not normally recommended to do DDL inside the same transaction
as DML. The only way you can do it is to use the execute statement
syntax (see release notes).
Adam