Subject Re: [firebird-support] Create Users Error Firebird
Author Tomasz Tyrakowski
You can't create users in stored procedures, just as you can't create
other objects (tables, procedures etc.). Metadata manipulation (DDL
statements) is not allowed inside stored procedures.
You might consider to use EXECUTE STATEMENT block in your procedure
(look it up in the Firebird language updates and other manuals), wchich
circumvents this limitation, but I wouldn't recommend that (EXECUTE
STATEMENT gives little control over execution process and errors). A
short example:

create procedure NEWUSER
as
begin
execute statement 'CREATE USER fadmin PASSWORD ''fbfaq12'';'
end

(note the double apostrophes around password).

I guess that apart from creating a Firebird account, your procedure is
supposed to do some other initialization for new users in a particular
database (otherwise why bother with the procedure). I would recommend
splitting user creation into two steps (two queries): first create the
user and set the password (via CREATE USER statement), and then execute
your procedure to do some local initialization. Or go for EXECUTE
STATEMENT and hope for the best ;)

regards
Tomasz

On 2012-01-04 15:02, Ahmet Nuri D wrote:
> I am useing firebird 2.5.1
> I have my own users table
> I create one store procedure for create user.
> And add that code for testing,
> "CREATE USER fadmin PASSWORD 'fbfaq12';"
> there is error message
> "
> Invalid token.
> Dynamic SQL Error.
> SQL error code = -104.
> Token unknown - line 5, column 3.
> CREATE.
>
> "
> where is my mistakes?
>
>


--
__--==============================--__
__--== Tomasz Tyrakowski ==--__
__--== SOL-SYSTEM ==--__
__--== http://www.sol-system.pl ==--__
__--==============================--__