Subject Re: [firebird-support] How to drop a user only if it does exist.
Author Ichiro Kobayashi
I've tried it, Thomas.
Such as :

DROP USER FONDA

But it does give a message like this :

"Cannot commit transaction:
Unsuccessful execution caused by system error that does not preclude
successful execution of subsequent statements.
record not found for user: FONDA."

FYI, i need to use it at my trigger.

May use something like this :

**
if (exists(select distinct rdb$user
from rdb$user_privileges
where rdb$user=OLD.username)) then
EXECUTE STATEMENT 'DROP USER '|| OLD.username;
**
??

However, Thank You in Advance Thomas, for a very quick response !

Regards,
Ichiro Kobayashi

On 12/16/11, Thomas Steinmaurer <ts@...> wrote:
>> I'd like to ask :
>> How to drop a user only if it does exist ?
>
> Use the new syntax:
>
> DROP USER <your_user>
>
>
> Doesn't give an error when the user doesn't exist.
>
>
> --
> With regards,
> Thomas Steinmaurer
>
> * Upscene Productions - Database Tools for Developers
> http://www.upscene.com/
>
> * My Blog
> http://blog.upscene.com/thomas/index.php
>
> * Firebird Foundation Committee Member
> http://www.firebirdsql.org/en/firebird-foundation/
>