Subject Re: [firebird-support] execute statement
Author Helen Borrie
At 08:54 AM 19/08/2006, you wrote:
>Hi, new to firebird here.
>
>I'm dabling with EXECUTE STATEMENT and I want to grant privileges with
>it byt I'm having problems with it. I found this code some were and it
>seems perfectly logical, and ir executes with no errors, but it just
>does not assign the privileges I want:
>
>ALTER PROCEDURE "SP_GRANT_ALL" ( "M_USER" CHAR(31) )
>AS
>DECLARE VARIABLE M_TABLE CHAR(31);
>begin
>for select RDB$RELATION_NAME as myTable
> from rdb$relations
> WHERE SUBSTRING(RDB$RELATION_NAME from 1 for 4) <> 'RDB$'
> INTO :m_table
>do
>begin
> execute statement 'grant all on ' || :m_table || ' to ' || :m_user; end
>suspend;
>end
> ^
>
>
>is it possible to use GRANT PRIVILEGES with EXECUTE STATEMENT?

Not as far as I know. As a minimum, you would have to be able to
grant all of the required privileges *first* to the procedure WITH
GRANT OPTION and I don't think that is supported.

A more sensible objective would be to write a SP that generates a
privileges script (using an external table).

./heLen