Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting into table of references

Status
Not open for further replies.

chris921

Technical User
Mar 9, 2004
82
GB
Code:
INSERT INTO TABLE (SELECT p.relates_To
FROM Player p WHERE PlayerNo = 1)
(SELECT REF (ap) FROM freeagents fa WHERE freeagentsno = 1);

Code:
CREATE TABLE freeagents OF freeagents_t (
freeagentsno PRIMARY KEY,
SCOPE FOR (relatesTo) IS Player,
SCOPE FOR (sold) IS SoldPlayer_table,
SCOPE FOR (availables) IS availableplayer_tab
);
/

Code:
CREATE OR REPLACE TYPE freeagents_t AS OBJECT (
freeagentsno NUMBER,
relatesTo REF Player_t,
makes REF SoldPlayer_t,
attends REF availableplayer_t,
Dateoftransfer date,
destinationclub VARCHAR2(200),
numberofclubsinterested NUMBER,
sellingprice NUMBER)
;
/

Code:
UPDATE freeagents SET relatesTo = 
(SELECT REF(P)  FROM Player P WHERE PlayerNo = 1)
WHERE freeagentsno= 1;

This doesnt work for some reason. It gives an error saying that:

ERROR at line 3:
ORA-00932: inconsistent datatypes: expected CHRIS.FREEAGENTS_T got REF CHRIS.FREEAGENTS_T

When I run the top piece of code.

Can anyone see what I should be doing? Its probably something really basic but I cant see it :(

Thanks in advance :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top