Well, I`m kinda new to this whole oracle thing, so the answer to my question is hopefully obvious to most of you.
I`ve created some types and tables, and everything worked out allright until I was gonna insert data into my table. The nested table within it doesn`t seem to act as a nested table since I can only choose one value.
Here is the code and I`m really stuck on this so I hope someone will respond.
CREATE OR REPLACE TYPE fagfelt_multi as object(
fagfelt VARCHAR2(30));
CREATE OR REPLACE TYPE fagfelt_nested_multi as table of fagfelt_multi;
CREATE OR REPLACE TYPE boktyp1 AS OBJECT(
isbn VARCHAR2(13),
tittel VARCHAR2(40),
fagfelt fagfelt_nested_multi,
har VARCHAR2(3),
forlagsnavn ref forlagstyp,
forfatter ref persontype1
)NOT FINAL;
CREATE TABLE boktab of boktyp1
NESTED TABLE fagfelt STORE AS fagfelt_multi_ntbl(
(PRIMARY KEY(nested_table_id,fagfelt))
ORGANIZATION INDEX COMPRESS)RETURN AS LOCATOR;
ALTER TABLE boktab
ADD CONSTRAINT pkbok PRIMARY KEY (isbn);
INSERT INTO boktab
SELECT
'1234561','Matte 103',
fagfelt_nested_multi(fagfelt_multi('matte','sol')) ,'ja',
REF (G),
REF (E)
FROM forlagstab G, persontab E
WHERE E.navn=personntyp('Geir', 'Nilsen')
AND G.navn='cappelen';
I can get it to work, but only with one value in fagfelt_nested_multi(fagfelt_multi, which sorta works against the purpose since its supposed to be multivalued.
In advance thanks ^
Edit: realized after posting that it`s saturday night, so did what I should of done in the first place, searched the topic, and realized the sollution was close.
fagfelt_nested_multi(fagfelt_multi('matte')fagfelt _multi('sol)),'ja',
Thanks for your previous threads!