Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can I create a generic ROWTYPE datatype using Objects...

Toon KoppelaarsNov 5 2003 — edited Nov 9 2003
Hi,

I have a question regarding the use of object features inside the server.

Take a look at the following package.

PL/SQL example..
================
package my_pack is
-- Overloaded versions of P1
P1(p_emprow in emp%rowtype);
P1(p_deptrow in dept%rowtype);
end;
/
package body my_pack is
P1(p_emprow in emp%rowtype) is
begin
insert into emp values p_emprow;
end;
P1(p_deptrow in dept%rowtype) is
begin
insert into dept values p_deptrow;
end;
end;
/

Is there some object-like alternative for this?
For instance can one build something like the following?

Object-like example
===================
procedure P1(p_table_name in varchar2
,p_record in "generic_record_type_using_object_types") is
begin
execute immediate 'insert into '||p_table_name||' values :b1'
using p_record;
end;
/

So if p_table_name = 'EMP' then p_record is of type EMP%ROWTYPE, and
if p_table_name = 'DEPT' then p_record is of type DEPT%ROWTYPE.

Toon
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2003
Added on Nov 5 2003
3 comments
2,890 views