My I-pl/sql Procedure

Source: Internet
Author: User
Tags exit end sql

Create or Replace procedure Cuidong_insert_records (P_ny in varchar2) is

  qystr         VARCHAR2 (260): = ' Daqing, Jilin, Liaohe, Jidong, Jiangsu, Shengli, Dong Hua branch, gas storage,                                    Zhongyuan, Henan, CNOOC, Hainan, north China, Jianghan, Zhejiang Exploration, ';   qy            MK_CSYB_XBSC. qy%type;  qy_position   Number (2);  qy_loop       number (2): = 1;     dwdmstr       VARCHAR2 (+): = ' ykgfgs,ekgfgs,skgfgs,jdfwzx,xwwhzx, tbwgs,ghshgs,gsshgs,                                  JSJDZX, Syjlzx,hse,gcjl,txgs,gsgs,js,sd,kygs, ';  temp_dwdmstr  varchar2;  dwdm           MK_CSYB_XBSC. dwdm%type;  dwdm_position Number (2);  dwdm_loop     number (2): = 1;    Do_ count      Number (2): = 0;begin  loop    Do_count: = Do_count + 1; & nbsp;  qy_position: = InStr (Qystr, ', ');    qy: = substr (qystr,1,qy_position-1);     QYSTR: = substr (Qystr,qy_position+1,length (QYSTR));    dbms_output. Put_Line (do_count| | '   ' | | qy_position| | '   ' | | qy| | '      ' | | P_ny);        dwdm_loop: = 1;    temp_dwdmstr: = dwdmstr;     loop      Dwdm_position: = InStr (Temp_dwdmstr, ', ');      DWDM: = substr (temp_dwdmstr,1,dwdm_position-1);      temp_dwdmstr: = substr (Temp_dwdmstr, Dwdm_position+1,length (TEMP_DWDMSTR));      dbms_output. Put_Line ('          ' | | dwdm_position| | '   ' | | dwdm| | '   ' | | P_NY);            INSERT INTO MK_CSYB_DBSC (NY, QY, LRRQ, Lrry, ZBDW, DWDM)          values (p_ny,qy,date ' 2005-04-05 ', ' East market Entry ', ' Market development Department ', DWDM);             Dwdm_loop: = Dwdm_loop + 1;       If Dwdm_loop = then        exit;      End If;     End loop;        qy_loop: = Qy_loop + 1;    If Qy_loop = 1 6 then      exit;    End if;  End loop;    commit;  Exception when others then rollback;end Cuidong_insert_records;


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.