Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: what is wrong with my PL/SQL program?
Johnson wrote
> declare
> username varchar2;
> begin
> select user into username from dual; -- get the current user name
> grant alter user to username; -- grant the right to the user ***
> end;
>
> when I run the script, I was always told there was something
> wrong with the grant sentence. So what is wrong with it?
You declared username to be varchar2. As far as I know, this defaults to length 1, which most likely is too small for your username. Furthermore, you cannot issue the GRANT from within PL/SQL. You need dynamic SQL for that, just like when you would need CREATE TABLE etc.
Arjan.
PS. I hope you can read my reply, as it looks strange here. My Outlook Express somehow feels that Japanese English should use a different font than US English. So, please reply to the group when you read this... :-) Received on Mon Mar 29 1999 - 10:35:39 CST