aspose file tools*
The moose likes Oracle/OAS and the fly likes REF Column creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "REF Column creation" Watch "REF Column creation" New topic
Author

REF Column creation

Jennifer Bhamoo
Ranch Hand

Joined: Mar 09, 2002
Posts: 47
Hello,
I understand the concept behind a REF column within a table, but I don't know how to actually create one??! Can someone give me a pointer or clue on how to do this?
Thank you,
Jennifer
Beksy Kurian
Ranch Hand

Joined: Jul 11, 2001
Posts: 254
Jennifer,
I got a sample from Oracle. This is my test on Oracle 8.1.7
SQL> create type ref_source as object(r1 number, r2 varchar2(10));
2 /
Type created.
SQL> create table use_ref_source of ref_source;
Table created.
SQL> insert into use_ref_source values(1,'Row 1');
1 row created.
SQL> insert into use_ref_source values(2,'Row 2');
1 row created.
SQL> insert into use_ref_source values(3,'Row 3');
1 row created.
SQL> insert into use_ref_source values(4,'Row 4');
1 row created.
SQL> insert into use_ref_source values(5,'Row 5');
1 row created.
SQL> commit;
Commit complete.
SQL> create type ref_vrry is VARRAY(5) of REF ref_source;
2 /
Type created.
SQL> create table use_ref_vrry(c1 number, c2 ref_vrry);
Table created.
SQL> insert into use_ref_vrry values(10, ref_vrry());
1 row created.
SQL> insert into use_ref_vrry values(20, CAST(MULTISET(select REF(urs) from use_ref_source urs where
r1 in (2,4)) AS ref_vrry));
1 row created.
SQL> commit;
Commit complete.
SQL> desc use_ref_vrry
Name Null? Type
----------------------------------------- -------- ----------------------------
C1 NUMBER
C2 REF_VRRY
SQL> column c2 format a60
SQL> select * from use_ref_vrry;
10 REF_VRRY()
20 REF_VRRY(0000280209A469495EC82B145DE0340800207ED400A469495EC
829145DE0340800207ED400014007630001, 0000280209A469495EC82D1
45DE0340800207ED400A469495EC829145DE0340800207ED400014007630
003)

Hope it helps!
Beksy
Jennifer Bhamoo
Ranch Hand

Joined: Mar 09, 2002
Posts: 47
Thank you Beksy.
I'm still reviewing it and playing around. I am studying for Build Internet Apps II exam, which covers REF columns, and I got concept down in relation to forms development, but couldn't get on how to implement it, so that I could actually see REF characteristics within Form Builder.
Thanks again!
Jennifer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: REF Column creation