Pl/SQL programming data types in Oracle

Source: Internet
Author: User
Tags scalar

Pl/SQL programming data type in Oracle pl Programming Data Type: www.2cto.com 1. scalar type (scalar) 2. composite 3. reference Type 4.lob( large object) -------------------------------------------------------------- case 1 of defining a scalar. defines a variable-length string v_ename varchar2 (10) 2. define a decimal number ranging from-9999.99 to 9999.99 v_sal number (6, 2) 3. define a decimal number and assign a value of 5.4: = To the pl/SQL value v_sal2 number (6, 2): = 5.4 4. define a date type of data v_hiredate date; 5. define a boolean variable. It cannot be empty. The initial value is false v_valid boolean not null default false; ---------------------------------------------------- the variable 1.pl/ SQL record 2.pl/ SQL Table 3 that stores multiple values. nested table 4. varray -------------------------------------------------------- reference variables are divided into: cursor variables and object variables case 1 Please use pl/SQL to write a block, you can enter the Department number and display all declare -- Define a cursor type chenchuang_emp_cursor is ref cursor; -- Define a cursor variable test_cursor chenchuang_emp_cursor -- Define the variable v_ename emp. name % type v_sal emp. sal % typebegin -- execute -- combine test_cursor and a select statement with open testr_cursor for select ename, sal from emp wheredeptno = & no; -- cyclically retrieve loop fetch test_cursor into v_ename, v_sal; -- determine whether testr_cursor is null exit when testr_cursor % notfound; dbms_output.put_line ('name' | v_name | 'wage '| v_sal); end loop; end;

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.