Oracle uses loops to retrieve the corresponding data in bulk

Source: Internet
Author: User

Match by single character query

begin DeclarecursorMyemp_cur is Select *  fromTable_a AwhereA.type1='User'; type Myemp_tab is Table  ofTable_a%rowtype;myemp_rd Myemp_tab;beginOpenmyemp_cur;loop --Cycle 1 FetchMyemp_curBulkCollect intoMYEMP_RD limit -; forIinch 1.. Myemp_rd.CountLoop
Dbms_output.put_line (' ********************************************************** ');d bms_output.put_line ('target object:'||myemp_rd (i). MKT_TRADE_TYPE_DESC);d Bms_output.put_line ('Result object:');--Cycle 2DeclareI_num Number;begin SelectLength (Myemp_rd (i). MKT_TRADE_TYPE_DESC) intoI_num fromdual; forI1inch 1.. I_num Loop
Dbms_output.put_line (i1| | ' --');
--Cycle 3    Declare    cursorMyemp_cur1 is Select *  fromTable_a Awherea.dk_system_of_upd!='FCMS'  andA.mkt_trade_type_desc like '%'||substr (Myemp_rd (i). MKT_TRADE_TYPE_DESC,I1,1)||'%'; Type MYEMP_TAB1 is Table  ofTable_a%RowType;    Myemp_rd1 MYEMP_TAB1; begin    OpenMyemp_cur1; LoopFetchMyemp_cur1BulkCollect intoMyemp_rd1 limit -;  fori3inch 1.. Myemp_rd1.CountLoop dbms_output.put_line (i3||':'||myemp_rd1 (i3).    MKT_TRADE_TYPE_DESC); EndLoop; Exit  whenMyemp_cur1%NotFound; EndLoop; End;--EndLoop;End;--EndLoop;Exit  whenMyemp_cur%NotFound;EndLoop;End;End;

Results:
It's not very satisfying. Replace with two characters after matching:

It looks much clearer.



Oracle uses loops to retrieve the corresponding data in bulk

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.