Oracle Database PL SQL Cursors

Source: Internet
Author: User

PL SQL Cursors

Hrno records in the Hregright table that do not exist are populated with the Hrno in the House table (house only)

Declare      cursorHouse_cur is      SelectH.regno,h.hrno fromHouse HwhereH.hrno is  not NULL Group  byH.regno,h.hrno having Count(H.regno)=1; begin       forHouseinchHouse_cur LoopUpdateHregright RSetR.hrno=House.hrnowhereR.regno=House.regno andR.hrno is NULL; EndLoop; End;

PL SQL variable

(1). Defines a variable-length string V_enamevarchar2(Ten); (2). Define a decimal, range-9999.99~9999.99V_sal Number(6,2); (3). Define a decimal and give an initial value of 5.4:=It's pl./the assignment number of SQL V_sal2 Number(6,2):=5.4; (4). Defines a date type of data v_hiredate date; (5). Defines a Boolean variable that cannot be null and has an initial value of False V_valid Boolean not NULL defaultFalse
Declarec_tax_rate Number(3,2):=0.03; --User nameV_enamevarchar2(5); V_sal Number(7,2); V_tax_sal Number(7,2); begin    --Execution    SelectEname,sal intoV_ename,v_sal fromEmpwhereEmpno=&No; --Calculate Income TaxV_tax_sal:=V_sal*c_tax_rate; --OutputDbms_output.put_line ('the name is:'||V_ename||'Salary:'||V_sal||'Tax:'||v_tax_sal); End;
DECLARE         varchar2 (begin V_A1: =      ' M000000000 ' ;        Update set a.a1=where a.a0='0000000000'  End;

Oracle Database PL SQL Cursor

Related Article

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.