PL/SQL on-machine Practice (i)

Source: Internet
Author: User
Tags first string

_ (: _"∠) _ _ (: _"∠) _ _ (: _"∠) _ Cheat Traffic Series _ (: _"∠) _ _ (: _"∠) _ _ (: _"∠) _

Title Description:

The names of all employees in the employee table are treated as follows: The first letter of the name is between ' A ' and ' G ', merged into the first string, between ' H ' and ' O ', merged into a second string, between ' P ' and ' Z ', merged into a third string, separated by a space between the names.

Code:

DECLAREstr1 String ( -); str2 string ( -); Str3 string ( -);CURSORName_ag isSELECTEname fromEmpWHERESUBSTR (ename,0,1)between 'A'  and 'G'; name1 Emp. Ename%TYPE;CURSORName_ho isSELECTEname fromEmpWHERESUBSTR (ename,0,1)between 'H'  and 'O'; name2 emp. Ename%TYPE;CURSORName_pz isSELECTEname fromEmpWHERESUBSTR (ename,0,1)between 'P'  and 'Z'; Name3 emp. Ename%TYPE;BEGINOPENName_ag;OPENName_ho;OPENName_pz; LOOPFETCHName_ag intoname1; EXIT  whenName_ag%NOTFOUND; STR1:=Str1||Name1||' ';ENDLOOP; LOOPFETCHName_ho intoname2; EXIT  whenName_ho%NOTFOUND; STR2:=str2||Name2||' ';ENDLOOP; LOOPFETCHName_pz intoName3; EXIT  whenName_pz%NOTFOUND; STR3:=Str3||Name3||' ';ENDloop;dbms_output.put_line (str1);d bms_output.put_line (str2);d bms_output.put_line (STR3);END;

PL/SQL on-machine Practice (i)

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.