Alter User not working in oracle -
i'm doing follwing question
managing locked accounts – utility should able identify each locked account locked because of invalid login attempts. utility should further unlock accounts have been locked more week.
----------------------------------------my code------------------------------------------
procedure managing_locked num int; v_sql varchar(50); begin x in (select username,lock_date,account_status,profile dba_users account_status ='locked(timed)') loop dbms_output.put_line('username: '|| x.username); dbms_output.put_line('lock_date: '|| x.lock_date ); dbms_output.put_line('account_status: '||x.account_status); dbms_output.put_line('profile: ' ||x.profile); dbms_output.put_line('*********************'); select ((sysdate - x.lock_date)) num dual; if(num>7) v_sql := 'alter user'|| x.username ||'account unlock'; dbms_output.put_line(x.username||' unlock'); execute immediate(v_sql); end if; end loop; end;
error 00940. 00000 - "invalid alter command"
i getting error , don't see wrong alter command
just in order catch each possible status clause should one:
where account_status in ( 'locked(timed)', 'expired & locked(timed)', 'expired(grace) & locked(timed)')
or
where account_status '%locked(timed)'
Comments
Post a Comment