The structure of Oracle's Pl_sql

Source: Internet
Author: User

--structure of PL/SQL
Declare --declaring variables and constant keywordsV_name Nvarchar2 ( -); V_ageinteger;--General Variable DeclarationV_product Table_name.column_name%Type--Life variables according to the Type of table fieldV_CON constantint:= A; V_CONVAR constant Nvarchar2 ( -):='Constants';--declaring constants must add keywords constant
       --declaring a compound type variableType Product_rec isRecord (IDint, name Table_name.column_name%type, age Number(Ten,2)
       );
       
       V_prod Product_rec; --declaring compound variables with RowType
       --v_prod_d Table_name%rowtype;
       
       --Index Table type declarationType ProductInfo is Table  of varchar2( +)Index  byPls_integer;--The Pls_integer and binary_integer effects are the same, specifying the index type. Type ProductType is Table  oftable_name%RowTypeIndex  byBinary_integer; --variables for the Life Index table type
V_procinfo ProductInfo;
       
       V_producttype ProductType; --varray variable ArrayType V_array isVarray ( -) of varchar2( -); V_arry V_array:=V_array ('1','2');--V_array (' 1 ', ' 2 ') initializes two subscript data
       
       

begin
--the starting part of code executionV_name:='Little Pony'; Select 'Xiaoxiao'  intoV_name fromdual; --use of compound variablesV_prod.id:=1; V_prod.name:='Little Black'; V_prod.age:= the; --use of index variablesV_procinfo (1):='XIXIX'; --assigning values to variable-length arraysV_arry (1):=' This'; V_arry (2):='This AA'; Exception--exception Execution part of program
 whenNo_data_found ThenDbms_output.put_line ('program exception. '); End;

The structure of Oracle's Pl_sql

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.