Forkmohit
Forkmohit

Reputation: 753

Extra column for a table object

 moni EmployeeTable%rowtype;

I have a Table object moni with row type as of Employee table. But instead I also want to add few more columns to moni in addition to Employee table columns.

What is the cleanest way to do it?

Upvotes: 1

Views: 89

Answers (1)

William Robertson
William Robertson

Reputation: 16001

One way would be to define a cursor and then use its %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;

Upvotes: 1

Related Questions