ORACLE存储过程关于建立复杂的数据类型

来源:互联网 发布:淘淘商城项目源码 编辑:程序博客网 时间:2024/06/05 22:53

1)数组

STATIC数组及其初始化:

TYPE VAR ISVARRAY(2) OF VARCHAR2(100);
 
 VAR_RECVAR := VAR(NULL,NULL);

  VAR_REC(1):= 'ZHAO';
    VAR_REC(2) := 'WEI';
    DBMS_OUTPUT.PUT_LINE(VAR_REC(1));
    DBMS_OUTPUT.PUT_LINE(VAR_REC(2));

<!-- /* Font Definitions */ @font-face{font-family:"MS Mincho";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-alt:"MS 明朝";mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:"MS Gothic";panose-1:2 11 6 9 7 2 5 8 2 4;mso-font-alt:"MS ゴシック";mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:Century;panose-1:2 4 6 4 5 5 5 2 3 4;mso-font-charset:0;mso-generic-font-family:roman;mso-font-pitch:variable;mso-font-signature:647 0 0 0 159 0;}@font-face{font-family:"/@MS Mincho";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:"/@MS Gothic";panose-1:2 11 6 9 7 2 5 8 2 4;mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:Century;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman";mso-font-kerning:1.0pt;mso-fareast-language:JA;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:612.0pt 792.0pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:36.0pt;mso-footer-margin:36.0pt;mso-paper-source:0;}div.Section1{page:Section1;}-->

DYNAMIC数组及其初始化:

TYPEMTKENGEN IS TABLE OF PLS_INTEGER ;

FOR IXIN 1..20 LOOP

        MKENGEN(IX) := 0 ;

END LOOP;

 

2)表

<!-- /* Font Definitions */ @font-face{font-family:"MS Mincho";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-alt:"MS 明朝";mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:"MS Gothic";panose-1:2 11 6 9 7 2 5 8 2 4;mso-font-alt:"MS ゴシック";mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:Century;panose-1:2 4 6 4 5 5 5 2 3 4;mso-font-charset:0;mso-generic-font-family:roman;mso-font-pitch:variable;mso-font-signature:647 0 0 0 159 0;}@font-face{font-family:"/@MS Mincho";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:"/@MS Gothic";panose-1:2 11 6 9 7 2 5 8 2 4;mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:Century;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman";mso-font-kerning:1.0pt;mso-fareast-language:JA;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:612.0pt 792.0pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:36.0pt;mso-footer-margin:36.0pt;mso-paper-source:0;}div.Section1{page:Section1;}-->TYPE ARR_USER_ID IS TABLEOF CHAR(10) INDEX BY BINARY_INTEGER;
 
 TYPEARR_USER_NM IS TABLE OF VARCHAR2(20) INDEX BYBINARY_INTEGER;

<!-- /* Font Definitions */ @font-face{font-family:"MS Mincho";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-alt:"MS 明朝";mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:"MS Gothic";panose-1:2 11 6 9 7 2 5 8 2 4;mso-font-alt:"MS ゴシック";mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:Century;panose-1:2 4 6 4 5 5 5 2 3 4;mso-font-charset:0;mso-generic-font-family:roman;mso-font-pitch:variable;mso-font-signature:647 0 0 0 159 0;}@font-face{font-family:"/@MS Mincho";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:"/@MS Gothic";panose-1:2 11 6 9 7 2 5 8 2 4;mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:Century;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman";mso-font-kerning:1.0pt;mso-fareast-language:JA;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:612.0pt 792.0pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:36.0pt;mso-footer-margin:36.0pt;mso-paper-source:0;}div.Section1{page:Section1;}-->TYPE REC_USER_TYPE IS RECORD(
    USER_ID ARR_USER_ID,
    USER_NM ARR_USER_NM
   
    );

<!-- /* Font Definitions */ @font-face{font-family:"MS Mincho";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-alt:"MS 明朝";mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:"MS Gothic";panose-1:2 11 6 9 7 2 5 8 2 4;mso-font-alt:"MS ゴシック";mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:Century;panose-1:2 4 6 4 5 5 5 2 3 4;mso-font-charset:0;mso-generic-font-family:roman;mso-font-pitch:variable;mso-font-signature:647 0 0 0 159 0;}@font-face{font-family:"/@MS Mincho";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:"/@MS Gothic";panose-1:2 11 6 9 7 2 5 8 2 4;mso-font-charset:128;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:Century;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman";mso-font-kerning:1.0pt;mso-fareast-language:JA;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:612.0pt 792.0pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:36.0pt;mso-footer-margin:36.0pt;mso-paper-source:0;}div.Section1{page:Section1;}-->REC_USER_TABLEREC_USER_TYPE;