1.how to find invalid status stored procedure and recompile them?
SELECT OBJECT_NAME , status FROM user_objects WHERE OBJECT_TYPE = ‘PROCEDURE‘;
Alter procedure schme.procedurename compile;
缺少练习的学习不是完整的学习,练习才是学习,总结才有思考。
SELECT OBJECT_NAME , STATUS FROM USER_OBJECTS WHERE OBJECT_TYPE = ‘PROCEDURE‘; ---sample table test(id integer,name varchar2) CREATE OR REPLACE PROCEDURE testsp(v_msg VARCHAR2) AS BEGIN DBMS_OUTPUT.PUT_LINE(v_msg); END testsp; ALTER PROCEDURE TESTSP COMPILE; SET SERVEROUTPUT ON; EXEC testsp(‘oracle stored procedure‘); EXEC testsp(‘hua xiao yao‘); CREATE OR REPLACE PROCEDURE procOneOutPara(v_msg VARCHAR2,v_out_p OUT varchar2) AS BEGIN DBMS_OUTPUT.PUT_LINE(v_msg); v_out_p :=‘execute success‘; END procOneOutPara; declare v_out_msg varchar2(100); begin procOneOutPara(‘hello java‘,v_out_msg); dbms_output.put_line(v_out_msg); end; CREATE OR REPLACE procedure procCursorReturn(v_id in integer ,outCursor OUT SYS_REFCURSOR ) AS BEGIN open outCursor for select * from test where id = v_id; exception when others then dbms_output.put_line(‘errors occurs‘); rollback; END procCursorReturn; DECLARE testCursor SYS_REFCURSOR; mytest test%ROWTYPE; BEGIN procCursorReturn(5,testCursor); LOOP FETCH testCursor INTO mytest; EXIT WHEN testCursor%NOTFOUND; dbms_output.put_line(mytest.name); END LOOP; CLOSE testCursor; END;
时间: 2024-11-25 06:56:10