Учитывая таблицу как это ...
SQL> create table cases
2 (case_no number
3 , plaintiff_ref REF person_t SCOPE IS plaintiffs
4 , defendant_ref REF person_t SCOPE IS defendants
5 , col1 varchar2(30)
6 , col2 varchar2(30)
7 )
8 /
Table created.
SQL>
Мы можем заполнить это так ...
SQL> insert into cases
2 select 1, ref(p), ref(d), '239 F.3d 1343', '35 USC § 283'
3 from plaintiffs p, defendants d
4 where p.id = 1000
5 and d.id=2000
6 /
1 row created.
SQL>
... или как это ...
SQL> declare
2 p_ref REF person_t;
3 d_ref REF person_t;
4 begin
5 select ref(p) into p_ref
6 from plaintiffs p
7 where p.id = 1000;
8 select ref(d) into d_ref
9 from defendants d
10 where d.id = 2000;
11
12 insert into cases
13 values
14 (2, p_ref, d_ref, 'YYT A.2e 789', '26 FTW § 169');
15 end;
16 /
PL/SQL procedure successfully completed.
SQL>
REFs очень длинные:
SQL> выбрать * из дел
2 /
CASE_NO
----------
PLAINTIFF_REF
--------------------------------------------------------------------------
DEFENDANT_REF
--------------------------------------------------------------------------
COL1 COL2
------------------------------ ------------------------------
1
0000220208771EFF0FAD71409F85A448C831C0C7B041CAA1874D514FDC9D18EF12DA22C12D
0000220208981D65F90A004146A1A390DC1048858777ECAC51136743B39A75F37D22DC1379
239 F.3d 1343 35 USC § 283
2
0000220208771EFF0FAD71409F85A448C831C0C7B041CAA1874D514FDC9D18EF12DA22C12D
0000220208981D65F90A004146A1A390DC1048858777ECAC51136743B39A75F37D22DC1379
YYT A.2e 789 26 FTW § 169
SQL>