Pl/sql Learning Notes (i)

Source: Internet
Author: User
Notes
The data types in Pl/sql are listed below:



number[(m,n)] unique numeric type. M-precision, n-decimal digit number. INTEGER, Real is the synonym definition of number.



VARCHAR2 (maxsize[char| BYTE]) is a unique string type. CHAR, Vachar is defined as a synonym for VARCHAR2. NVARCHAR2, like VARCHAR2, is used for international character set data types only.



Date/Time type.



A Boolean type. Only true, false two values.



Ii. Executive Body of Pl/sql



DECLARE



--Variable declaration



BEGIN



--Run the statement



EXCEPTION



--Exception handling



End;



Three, PL/SQL control structure



1. If-then-elsif structure



IF condition THEN



elsif conditions THEN



End IF;



2. Case structure



Case



When condition THEN

When condition THEN



...



ELSE if all conditions are not satisfied



End;



IV. circular structure (see example)



Declarei INTEGER; BEGIN



Dbms_output. Put_Line (' LOOP OUTPUT '); i:=0; Loopexit when I>=10;dbms_output. Put_Line (i); i:=i+1; End Loop;dbms_output. Put_Line (' while OUTPUT '); i:=0; While I<10 Loopdbms_output. Put_Line (i); i:=i+1; End Loop;dbms_output. Put_Line (' for OUTPUT '); For I in 1..10 loopdbms_output. Put_Line (i); End LOOP;



EXCEPTION when others THEN dbms_output. Put_Line (' EXCEPTION '); RAISE; end;/








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.