oracleÅÌÎÊËùÓд洢Àú³ÌÄÚÈݵÄÒªÁì
ÅÌÎÊ oracle Öд洢Àú³ÌÄÚÈݵÄÒªÁì°üÀ¨£ºÖ±½ÓÅÌÎÊÊý¾Ý×ÖµäÊÓͼ£¬Èç user_objects£»Ê¹Óà dbms_metadata °ü£¬±éÀú all_objects ÊÓͼÖеÄÀú³Ì£»Ê¹Óà dbms_utility °ü£¬ÆÊÎö all_source ÊÓͼÖеÄÀú³ÌºÍº¯Êý½¨ÉèÓï¾ä¡£
Oracle ÅÌÎÊËùÓд洢Àú³ÌÄÚÈݵÄÒªÁ죺
Ö±½ÓÅÌÎÊÊý¾Ý×ÖµäÊÓͼ
SELECT OBJECT_NAME, OBJECT_TYPE, OBJECT_DEFINITION FROM USER_OBJECTS WHERE OBJECT_TYPE IN ('PROCEDURE', 'FUNCTION');
µÇ¼ºó¸´ÖÆ
ʹÓà DBMS_METADATA °ü
DECLARE cursor_pkg DBMS_METADATA.REF_CURSOR; BEGIN DBMS_METADATA.OPEN_REF_CURSOR(cursor_pkg, 'ALL_OBJECTS', 'PROCEDURE'); LOOP FETCH cursor_pkg INTO object_name, object_type, object_definition; EXIT WHEN cursor_pkg%NOTFOUND; DBMS_OUTPUT.PUT_LINE(object_name || ' ' || object_type); DBMS_OUTPUT.PUT_LINE('=' * LENGTH(object_name) || ' ' || '=' * LENGTH(object_type)); DBMS_OUTPUT.PUT_LINE(object_definition); DBMS_OUTPUT.PUT_LINE(''); END LOOP; DBMS_METADATA.CLOSE_REF_CURSOR(cursor_pkg); END;
µÇ¼ºó¸´ÖÆ
ʹÓà DBMS_UTILITY °ü
DECLARE cursor_src DBMS_UTILITY.CURSOR_TYPE; line VARCHAR2(2000); type_owner VARCHAR2(30); type_name VARCHAR2(30); BEGIN DBMS_UTILITY.SET_SOURCE(cursor_src, 'all_source'); LOOP FETCH cursor_src INTO line; EXIT WHEN cursor_src%NOTFOUND; IF line LIKE '%CREATE PROCEDURE%' THEN DBMS_UTILITY.PARSE_INTO_HIERARCHY(cursor_src, type_owner, type_name); DBMS_OUTPUT.PUT_LINE('Owner: ' || type_owner); DBMS_OUTPUT.PUT_LINE('Object: ' || type_name); DBMS_OUTPUT.PUT_LINE('=' * LENGTH(type_owner) || ' ' || '=' * LENGTH(type_name)); DBMS_OUTPUT.PUT_LINE(line); ELSIF line LIKE '%CREATE FUNCTION%' THEN DBMS_UTILITY.PARSE_INTO_HIERARCHY(cursor_src, type_owner, type_name); DBMS_OUTPUT.PUT_LINE('Owner: ' || type_owner); DBMS_OUTPUT.PUT_LINE('Object: ' || type_name); DBMS_OUTPUT.PUT_LINE('=' * LENGTH(type_owner) || ' ' || '=' * LENGTH(type_name)); DBMS_OUTPUT.PUT_LINE(line); END IF; END LOOP; DBMS_UTILITY.CLOSE_CURSOR(cursor_src); END;
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇoracleÅÌÎÊËùÓд洢Àú³ÌÄÚÈݵÄÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£