PL/SQL data type

Source: Internet
Author: User

Create or replace procedure Pr_mytest is

V_test number (8);--Variable
V_char VARCHAR2 (10);

C_CHANGL constant Number (12,3): = 3.14;--constant

V_BM T_hq_ryxx.bumbm%type;

Type Ty_ry is record--defines a record type
(
V_XINGM T_hq_ryxx.xingm%type,
V_XINGB T_hq_ryxx.xingb%type,
V_gongz T_hq_ryxx.gongz%type
);

V_ry Ty_ry; --Declare variables of this type of record

V_ryrow t_hq_ryxx%rowtype;--to define all fields of a table as record types

Type Ty_xs is record
(
V_sno T_hq_student.sno%type,
V_sname T_hq_student.sname%type,
V_class T_hq_student.class%type
);

V_xs Ty_xs;

V_xsrow T_hq_student%rowtype;

Begin

V_char: = ' Hello ';

Select Xingm,xingb,gongz to V_ry from t_hq_ryxx where rownum = 1;

Dbms_output.put_line (v_ry.v_xingm | | ' ' | | V_RY.V_XINGB | | ' ' | | V_ry.v_gongz);

SELECT * into V_ryrow from t_hq_ryxx where rownum = 1;

Dbms_output.put_line (v_ryrow.xingm | | ' ' | | V_RYROW.XINGB | | ' ' | | V_ryrow.gongz);

Select BUMBM to V_BM from T_hq_ryxx where rownum < 2;

Dbms_output.put_line (V_char | | ', test stored procedure, record number of bars: ' | | V_BM);

Select Sno,sname,class to V_xs from t_hq_student where rownum = 1;

Dbms_output.put_line (V_xs.v_sno | | "| | V_xs.v_sname | | "| | V_xs.v_class);

SELECT * into V_xsrow from t_hq_student where rownum = 1;

Dbms_output.put_line (V_xsrow.sno | | "| | V_xsrow.sname | | "| | V_xsrow.sbirthday | | "| | V_xsrow.class);

End Pr_mytest;

PL/SQL data type

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.