我有一系列我定义的表格和对象。我有一个对象嵌套表,我试图插入值。值是变量数组的形式,但我不知道如何插入它们。我的表和代码如下。
crn number(5)
department varchar2(8)
title carchar2(25)
student_id char(11)
name varchar2(10)
dept varchar2(8)
advisor varchar(10)
classes wu.classes_va
wu.classes_va varray(5) of number (5)
create type classes_ty as object(crn varchar2(5),department varchar2(8), coursetitle varchar2(25)
create table classes_ot of classes_ty;
insert into classes_ot select crn,department,title from wu.classes;
create or replace type classes_ref_ty as table of ref classes_ty;
create table student_plus(student# varchar2(11),student_name varchar2(10),major varchar2(8), advisor (10), enrolled classes_ref_ty) nested table enrolled store as classes_ref_ty_tab;
问题在这里(我需要循环填写表格,但我只需要知道如何为一个值做这个,我可以把剩下的数字拿出来):
begin
insert into student_plus values('700-123-948','Hooker','CS','VanScoy',classes_ref_ty();
insert into table(select enrolled from student_plus where student#='700-123-948')
select ref(c) from classes_ot c where ???
end;
/
我不知道如何访问变量数组并将其与classes_ref_ty一起使用。