×ðÁú¿­Ê±¹ÙÍøµÇ¼

oracleÅÌÎÊËùÓд洢Àú³ÌÄÚÈݵĺ¯Êý

¿ÉÒÔͨ¹ý oracle ÌṩµÄ dbms_metadata.get_ddl º¯Êý»ñÈ¡´æ´¢Àú³ÌµÄÄÚÈÝ£¬°üÀ¨Ô´´úÂ룺ÉèÖà object_type Ϊ “procedure”ÉèÖà object_name Ϊ´æ´¢Àú³ÌÃû³ÆʹÓà select Óï¾ä»ñÈ¡ÄÚÈÝ

ÅÌÎÊ Oracle ´æ´¢Àú³ÌÄÚÈݵĺ¯Êý

»Ø¸²£ºOracle ÌṩÁË DBMS_METADATA.GET_DDL º¯Êý£¬¿ÉÒÔ»ñÈ¡´æ´¢Àú³ÌµÄÄÚÈÝ£¬°üÀ¨ÆäÔ´´úÂë¡£

Ïêϸ˵Ã÷£º

DBMS_METADATA.GET_DDL º¯ÊýÐèÒªÁ½¸ö²ÎÊý£º

object_type£ºÒª»ñÈ¡ÄÚÈݵŤ¾ßÀàÐÍ£¬¹ØÓÚ´æ´¢Àú³Ì£¬ÖµÎª “PROCEDURE”

object_name£ºÒª»ñÈ¡ÄÚÈݵŤǩ×ֳƣ¬¼´´æ´¢Àú³ÌµÄÃû³Æ

Ó÷¨£º

SELECT DBMS_METADATA.GET_DDL('PROCEDURE', 'stored_proc_name') FROM DUAL;

µÇ¼ºó¸´ÖÆ

´ËÅÌÎʽ«·µ»ØÖ¸¶¨´æ´¢Àú³ÌµÄÔ´´úÂ룬°üÀ¨Æä CREATE Óï¾äºÍËùÓÐÏà¹Ø´úÂë¡£

ʾÀý£º

¼ÙÉèÎÒÃÇÓÐÒ»¸öÃûΪ EMPLOYEES µÄ´æ´¢Àú³Ì£¬ÆäÄÚÈÝÈçÏ£º

CREATE PROCEDURE EMPLOYEES AS
BEGIN
  DBMS_OUTPUT.PUT_LINE('Employee Details:');
  FOR emp_rec IN (SELECT * FROM employees) LOOP
    DBMS_OUTPUT.PUT_LINE('Name: ' || emp_rec.first_name || ' ' || emp_rec.last_name);
  END LOOP;
END;

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ʹÓà DBMS_METADATA.GET_DDL º¯Êý»ñÈ¡´Ë´æ´¢Àú³ÌµÄÄÚÈÝ£º

SELECT DBMS_METADATA.GET_DDL('PROCEDURE', 'EMPLOYEES') FROM DUAL;

µÇ¼ºó¸´ÖÆ

Êä³ö£º

CREATE PROCEDURE EMPLOYEES AS
BEGIN
  DBMS_OUTPUT.PUT_LINE('Employee Details:');
  FOR emp_rec IN (SELECT * FROM employees) LOOP
    DBMS_OUTPUT.PUT_LINE('Name: ' || emp_rec.first_name || ' ' || emp_rec.last_name);
  END LOOP;
END;

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ͨ¹ýÕâÖÖ·½·¨£¬Äú¿ÉÒÔÇáËɵØÉó²éºÍ¼ìË÷ÈκΠOracle ´æ´¢Àú³ÌµÄÄÚÈÝ£¬°üÀ¨ÆäÔ´´úÂë¡£

ÒÔÉϾÍÊÇoracleÅÌÎÊËùÓд洢Àú³ÌÄÚÈݵĺ¯ÊýµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ