Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Insert & update nested table

848302Apr 21 2011 — edited Apr 21 2011
Hi

I have created one nested table with the follwing columns. I have to insert records into the nested table. And also I have to update the nested table. Please find below my table and getting error message.

Please advose...!!
SQL> create type details as object(
  2  basic number(7,2),
  3  da number(6,2),
  4  hra number(6,2),
  5  pf number(6,2),
  6  it number(6,2),
  7  gross number(7,2),
  8  ded number(6,2),
  9  net number(8,2));
 10  /

Type created.

SQL> create type details_t is table of details;
  2  /

Type created.


SQL> ed
Wrote file afiedt.buf

  1  create table emp_tab(empno number(4),name varchar2(10),details_tab details_t)
  2* nested table details_tab store as empl_details
SQL> /

Table created.


SQL> ed
Wrote file afiedt.buf

  1* insert into emp_tab values(&empno,'&name',details_t(details(&da,&hra,&pf,&it,null,null,null)))
SQL> /
Enter value for empno: 1
Enter value for name: asdf
Enter value for da: 120
Enter value for hra: 130
Enter value for pf: 120
Enter value for it: 120
old   1: insert into emp_tab values(&empno,'&name',details_t(details(&da,&hra,&pf,&it,null,null,null
new   1: insert into emp_tab values(1,'asdf',details_t(details(120,130,120,120,null,null,null)))
insert into emp_tab values(1,'asdf',details_t(details(120,130,120,120,null,null,null)))
                                             *
ERROR at line 1:
ORA-02315: incorrect number of arguments for default constructor
Can I use '&' while inserting records into nested table? yes / no ?

I have to update gross, ded, net columns also..!!

Please help me..!!

Regards
A
This post has been answered by Saubhik Banerjee on Apr 21 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2011
Added on Apr 21 2011
4 comments
2,073 views