日期:2014-05-17 浏览次数:21301 次
declare cursor c1 is select username,password from dba_users; v_name varchar2(200); v_pwd varchar2(200); begin open c1; loop fetch c1 into v_name,v_pwd; exit when c1%notfound; --修改密码 update dba_users set password='密码' where username=v_name; commit; end loop; close c1; end;
------解决方案--------------------
--不要随便修改系统字典表,可使用动态SQL DECLARE pass VARCHAR2(20) := 'aaa';--你的密码 BEGIN FOR c IN (SELECT t.username FROM dba_users t) LOOP EXECUTE IMMEDIATE 'alter user ' || c.username || ' identified by ' || pass; END LOOP; END; /