动态sql建用户的问题
最近在看书,看到动态sql这章,做了个练习,但怎么执行都不过了,请大哥哥们回复
如下:
create or replace procedure dynamicsql as
t_sql varchar2(200);
t_classno varchar(10);
t_stuid varchar(10);
t_infos infos%rowtype;
t_user varchar(20);
t_password varchar(20);
cursor cur_infos is select * from infos;
begin
for t_infos in cur_infos loop
t_stuid:=t_infos.stuid;
t_classno:=t_infos.classno;
t_sql:='create user :1 identified by :2 account unlock';
t_user:=CONCAT(t_stuid,t_classno);
t_password:=CONCAT(t_stuid,t_classno);
dbms_output.put_line(t_user);
execute immediate t_sql using t_user,t_password;
t_sql:='grant :1 to :2';
execute immediate t_sql using 'connect',t_user;
execute immediate t_sql using 'resource',t_user;
end loop;
end;
------解决方案--------------------是不是权限的问题