我正在试图弄清楚为什么会抛出错误。
这是我的对象类型
CREATE type address_typ as object (
street varchar2(60),
city varchar2(19),
pCode varchar2(9)
)
Final;
/
CREATE type person_typ as object
(
pNInum varchar2(9),
pName name_typ,
pAddress address_typ,
pPhone Phone_array
)
Not Final;
/
CREATE type employee_typ under person_typ
(
emp_ID varchar2(11),
joinDate date,
position varchar2(14),
salary number,
branch_r ref branch_typ
)
Final;
/
这些是我的表插入查询。
insert into person_table values(employee_typ('NI001',Name_type('Mrs ','Alison ','Smith '),address_typ('Dart','Edinburgh', 'EH105TT'),Phone_array('01312125555','07705623443','07907812345'),,to_date('01/02/2016','dd-mm-yyyy'),'Head',50000,(select ref(b) from Branch_table b where b.bid='901')));
insert into person_table values(employee_typ('NI010',Name_type('Mr','John','William'),address_typ('New','Edinburgh', 'EH24AB'),Phone_array('01312031990','07902314551','07701234567'),,to_date('04/03/2007','dd-mm-yyyy'),'Manager',40000,(select ref(b) from Branch_table b where b.bid='901')));
insert into person_table values(employee_typ('NI120',Name_type('Mr','Mark','Slack'),address_typ('Old','Edinburgh', 'EH94BB'),Phone_array('01312102211','',''),,to_date('01/02/2009','dd-mm-yyyy'),'Accountant',30000,(select ref(b) from Branch_table b where b.bid='901')));
insert into person_table values(employee_typ('NI810',Name_type('Mr','Jack','Smith '),address_typ('Adam','Edinburgh', 'EH16EA'),Phone_array('01311112223','0781209890',''),,to_date('05/02/2008','dd-mm-yyyy'),'Project Leader ',35000,(select ref(b) from Branch_table b where b.bid='908')));
insert into person_table values(employee_typ('NI234',Name_type('Mr ','Muneeb ','Khan'),address_typ('5432 Castlehill',' Edinburgh', ' EH1 2ND'),Phone_array('01312224535','0745679945','07468452746'),,to_date('20/09/1982','dd-mm-yyyy'),'Project Leader ',35000,(select ref(b) from Branch_table b where b.bid='901')));
insert into person_table values(employee_typ('NI256',Name_type('Mrs ','Stephanie ','Fagan '),address_typ('276 Cockburn Street',' Edinburgh', ' EH1 1BP'),Phone_array('01334545454','0776988453','07775744847'),,to_date('14/06/1984','dd-mm-yyyy'),'Cashier ',15000,(select ref(b) from Branch_table b where b.bid='901')));
insert into person_table values(employee_typ('NI453',Name_type('Mr','Steven ','Ojay'),address_typ('40 Hutchesontown Court','Glasgow ', ' G5 0SX'),Phone_array('01414567865','0777457457','07564634645'),,to_date('19/07/1985','dd-mm-yyyy'),'Manager',40000,(select ref(b) from Branch_table b where b.bid='902')));
insert into person_table values(employee_typ('NI343',Name_type('Miss','Linsday ','Reid '),address_typ('40 Carlton Place','Glasgow ', ' G5 9TW'),Phone_array('01418693048','0756748454','07474757479'),,to_date('19/01/1988','dd-mm-yyyy'),'Project Leader ',35000,(select ref(b) from Branch_table b where b.bid='902')));
insert into person_table values(employee_typ('NI896',Name_type('Mr','Stuart ','Reid '),address_typ('451 Lawmoor Street','Glasgow ', ' G54 3EJ'),Phone_array('01418363484','0777373464','07575757779'),,to_date('17/08/1988','dd-mm-yyyy'),'Accountant ',30000,(select ref(b) from Branch_table b where b.bid='902')));
insert into person_table values(employee_typ('NI645',Name_type('Miss ','Eveyln ','Ford '),address_typ('197 Cumberland Street','Glasgow ', ' G5 0SW'),Phone_array('01418569235','0773638293','07565656389'),,to_date('07/10/1988','dd-mm-yyyy'),'Cashier ',15000,(select ref(b) from Branch_table b where b.bid='902')));
insert into person_table values(employee_typ('NI543',Name_type('Mrs ','Rebbeca ','Duke '),address_typ('33 Queen Elizabeth Gardens','Glasgow ', ' G5 0UH'),Phone_array('01410593032','0736373748','07564749699'),,to_date('06/11/1989','dd-mm-yyyy'),'Manager ',40000,(select ref(b) from Branch_table b where b.bid='903')));
insert into person_table values(employee_typ('NI359',Name_type('Miss','Lauren ','Steve'),address_typ('Elmfoot Grove','Glasgow ', ' G5 0HF'),Phone_array('01419582039','0736484848','07464747468'),,to_date('23/05/1991','dd-mm-yyyy'),'Accountant ',30000,(select ref(b) from Branch_table b where b.bid='903')));
insert into person_table values(employee_typ('NI880',Name_type('Mr','Laurance ','Builder '),address_typ('232 Paisley Road','Glasgow ', ' G5 8NG'),Phone_array('01415034893','0777363737','07773856960'),,to_date('08/02/1994','dd-mm-yyyy'),'Project Leader ',35000,(select ref(b) from Branch_table b where b.bid='903')));
insert into person_table values(employee_typ('NI063',Name_type('Mr','Micheal','Jackson'),address_typ('31C Errol Gardens','Glasgow ', ' G5 0RA'),Phone_array('01415834349','0736383738','07773457374'),,to_date('11/07/1996','dd-mm-yyyy'),'Cashier ',15000,(select ref(b) from Branch_table b where b.bid='903')));
insert into person_table values(employee_typ('NI850',Name_type('Mrs ','Rebecca ','Tony'),address_typ('37 Carnoustie Street','Glasgow ', ' G5 8PN'),Phone_array('0141i8349349','0793834949','07583838835'),,to_date('26/12/1996','dd-mm-yyyy'),'Head ',50000,(select ref(b) from Branch_table b where b.bid='904')));
答案 0 :(得分:0)
问题是没有。每种类型的参数,当你引用或插入时给出相同的东西。
您定义address_typ
- > person_typ
和person_typ
- > employee_typ
并使用branch_typ
(您在问题中定义的地方?)
CREATE type employee_typ under person_typ
(
emp_ID varchar2(11),
joinDate date,
position varchar2(14),
salary number,
branch_r ref branch_typ /*where you define*/
)
Final;
检查链接。
http://oraclequirks.blogspot.in/2008/06/ora-02315-incorrect-number-of-arguments.html
https://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:10271519764319