Definition, assignment and use of Oracle variables

Source: Internet
Author: User
Tags array length

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

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.