Skip to Main Content

Oracle Database Discussions

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!

Insert data into an OR Table

999406May 10 2013 — edited May 10 2013
Can I please have some help to insert some data into a table.

I have created an Peripheral_objtyp object and then created a table from this object:

create type Peripheral_objtyp as Object (
PeriphNo NUMBER,
Comp_ref REF Computer_objtyp,
PeriphName varchar2(20),
PeriphType varchar2(20)
)
/

create table Peripheral_objtab of Peripheral_objtyp (PeriphNo Primary Key) Object ID Primary Key
/

Here is the Computer_objtyp:

create type Computer_objtyp as object (
CompNo Number,
CompName Varchar2(20),
CompOS Varchar2(20),
CompProcessor Varchar2(20),
CompRAM Varchar2(20),
CurrentUser_obj CurrentUser_objtyp,
HardDriveList_var HardDriveList_Vartyp )
/

I am wanting to insert some data into the Peripheral_objtab. This is the code I have tried:

INSERT INTO Peripheral_objtab
SELECT 1, REF(C), 'Test', 'Test'
FROM Computer_objtab C
Where C.CompNo = 1;

I am getting this error:

SQL Error: ORA-22979: cannot INSERT object view REF or user-defined REF
22979. 00000 - "cannot INSERT object view REF or user-defined REF"
*Cause: Attempt to insert an object view REF or user-defined REF in a
REF column created to store system generated REF values"
*Action: Make sure the REF to be inserted is not from an object view
or from a user-defined REF column
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2013
Added on May 10 2013
1 comment
145 views