First we take a look at the code, then we explain and interpret the code:
Declarel_deptinteger:= -; Currtime Date:=sysdate; L_namvarchar2( -) :=To_char (Add_months (Trunc (sysdate),- A),'YYYYMMDD');--to_char (sysdate, ' MM ') -13;type Num_list isVarray (4) of Number; arr_id num_list:=Num_list ( -,101,123, -,234); beginl_dept:= -; Dbms_output.put_line (l_dept); Dbms_output.put_line (Currtime); Dbms_output.put_line (L_nam); Dbms_output.put_line (arr_id (1)); End;
The definition of a variable:
L_dept defines an integral type,
Currtime is a date type,
The L_nam is a character type and is assigned a date that is 12 months forward, while--To_char (sysdate, ' MM ')-13; a negative number appears.
Type Num_list is Varray (4) of number, which defines an array with a data type of integral type, and an array length of 4.
arr_id num_list: = Num_list (100,101,123,33,234), the num_list variable is defined using the ARR_ID-defined array type, and the arr_id is assigned a value.
The Dbms_output.put_line function is exported in the DMS Output tab.
Definition, assignment and use of Oracle variables