用于表格对象的额外列

问题描述:

moni EmployeeTable%rowtype; 

我有一个Table对象moni,其行类型为Employee表。 但是,除了Employee表列之外,我还想向moni添加更多列。用于表格对象的额外列

干净的方法是什么?

一种方法是定义一个光标,然后使用其%rowtype

declare 
    cursor c_demo is 
     select s.*, 
       cast (null as varchar2(30)) as extra_column 
     from EmployeeTable s; 

    moni c_demo%rowtype; 
begin 
    moni.extra_column := 'Demo'; 
end;