0

My question is similar to 9454933 but my nested table is within the object.

I wish to create a table of user defined types where the defined type contains an object, my simplified setup looks like this

CREATE TYPE DEMO_TYPE1 AS OBJECT (A1 NUMBER, A2 NUMBER);

CREATE TYPE DEMO_TAB_TYPE1 AS TABLE OF DEMO_TYPE1;

CREATE TYPE DEMO_TYPE2 AS OBJECT (B1 NUMBER, B2 DEMO_TAB_TYPE1);

CREATE TABLE DEMO_TAB1 (C1 NUMBER, C2 DEMO_TYPE2);

If I run the above I get the following error

The storage clause is not specified for the nested table column or attribute.

This makes sense but I can't work out the correct syntax to fix this I've tried

CREATE TABLE DEMO_TAB1 (C1 NUMBER, C2 DEMO_TYPE2)
NESTED TABLE B2 STORE AS B2_TAB;

but this and every other variation I've tried result in ORA-00922: missing or invalid option

So how do I resolve this?

1 Answer 1

0

The reason of the error is that the C2 is not a nested table. The nested table is the B2 inside C2, so you should try this:

CREATE TABLE DEMO_TAB1 (C1 NUMBER, C2 DEMO_TYPE2)
NESTED TABLE C2.B2 STORE AS B2_TAB;

See sqlfiddle: sqlfiddle.com/#!4/6c662/1

3
  • I did try that as a solution but still get the same missing or invalid option. Jun 3, 2014 at 11:35
  • I have checked it before posting, it works. See sqlfiddle sqlfiddle.com/#!4/6c662/1, pls.
    – Guneli
    Jun 3, 2014 at 12:22
  • Sorry you were correct I had an additional typo in my SQL. Thanks for the answer and for the link to sqlfiddle it's a nice resource I'll try and remember it. Jun 3, 2014 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.