PL/SQL 用户自定义子类型

子类型具有与其基本类型相同的操作,但只有基本类型有效值的子集。

例如,pl/sql预先定义子类型characterinteger,如下所示:

subtype character is char; 
subtype integer is number(38,0);

并且,可以定义和使用自己的子类型:

declare 
   subtype name is char(20); 
   subtype message is varchar2(100); 
   salutation name; 
   greetings message; 
begin 
   salutation := 'reader '; 
   greetings := 'welcome to the world of pl/sql'; 
   dbms_output.put_line('hello ' || salutation || greetings); 
end; 

输出结果:
hello reader              welcome to the world of pl/sql

 

(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐