--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