2016-07-27 34 views
1
moni EmployeeTable%rowtype; 

我有一個Table對象moni,其行類型爲Employee表。 但是,除了Employee表列之外,我還想向moni添加更多列。用於表格對象的額外列

乾淨的方法是什麼?

回答

1

一種方法是定義一個光標,然後使用其%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;