如何恢复一个被误drop的存储过程(二)

2014-11-24 18:22:24 · 作者: · 浏览: 1
and ipacar = rec_pac.ipacar


and ipanvn = rec_pac.ipanvn


and ipanva = rec_pac.ipanva


and ipalrm = rec_pac.ipalrm;


else



TEXT


--------------------------------------------------------------------------------


update iwbpac


set ipastc = vc_ipastc


where ipacpr = rec_pac.ipacpr


and ipairl = rec_pac.ipairl


and ipacar = rec_pac.ipacar


and ipanvn = rec_pac.ipanvn


and ipanva = rec_pac.ipanva


and ipalrm = rec_pac.ipalrm;


end if;


end loop;


exception


when others then


n_flag := 0;


vc_message := substr(sqlerrm, 1, 1000);


end P_IPACCHECK_NC;



100 rows selected



补充:


sys@ORCL> select text from dba_source where owner='LSF' and name='EMP_SAL' order by line;


TEXT
-----------------------------------------------------------------------------------------------------------------------------------
procedure emp_sal
is
v_last_name employee.last_name%type;
v_employee_id employee.employee_id%type;
v_salary employee.salary%type;
cursor cursor_sal is
select last_name,employee_id,salary from employee where salary between 2000 and 3000;
begin
open cursor_sal;
loop
fetch cursor_sal into v_last_name,v_employee_id,v_salary;
exit when cursor_sal%notfound;
update employee set salary=salary*1.2 where last_name=v_last_name and employee_id=v_employee_id;
end loop;
close cursor_sal;
commit;
end;


17 rows selected.



SQL> show user
USER is "LSF"
SQL> select username from user_users;


USERNAME
------------------------------
LSF


SQL> select text from user_source where name='EMP_SAL' order by line;


TEXT
--------------------------------------------------------------------------------
procedure emp_sal
is
v_last_name employee.last_name%type;
v_employee_id employee.employee_id%type;
v_salary employee.salary%type;
cursor cursor_sal is
select last_name,employee_id,salary from employee where salary between 2000 and
3000;


begin
open cursor_sal;
loop
fetch cursor_sal into v_last_name,v_employee_id,v_salary;
exit when cursor_sal%notfound;
update employee set salary=salary*1.2 where last_name=v_last_name and employee_i
d=v_employee_id;


end loop;
close cursor_sal;
commit;
end;


17 rows selected.


SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;


TO_CHAR(SYSDATE,'YY
-------------------
2011-08-10 14:46:24


SQL> drop procedure emp_sal;


Procedure dropped.


SQL> select text from user_source where name='EMP_SAL' order by line;


no rows selected


SQL> select text from user_source as of timestamp to_timestamp('2011-08-10 14:46:24','YYYY-MM-DD HH24:MI:SS') where name='EMP_SAL' order by line;
select text from user_source as of timestamp to_timestamp('2011-08-10 14:46:24','YYYY-MM-DD HH24:MI:SS') where name='EMP_SAL' order by line
*
ERROR at line 1:
ORA-01031: insufficient privileges


sys@ORCL> select text from dba_source as of timestamp to_timestamp('2011-08-10 14:46:24','YYYY-MM-DD HH24:MI:SS') where owner='LSF' and name='EMP_SAL' order by line;


TEXT
-----------------------------------------------------------
procedure emp_sal
is
v_last_name employee.last_name%type;
v_employee_id employee.employee_id%type;
v_salary employee.salary%type;
cursor cursor_sal is
select last_name,employee_id,salary from employee where salary between 2000 and 3000;
begin
open cursor_sal;
loop
fetch cursor_sal into v_last_name,v_employ