I am trying to create a database of a conference. There are tables like Authors, Papers and a relation table. The Papers table contains the title of research and a nested table of reference to authors (because a study can be written by more than one person). The Authors table should be created of reference type? I can't figure out how to insert references in that nested table. Any ideas?
CREATE OR REPLACE TYPE AuthorType AS OBJECT (
name VARCHAR(30),
email VARCHAR(25),
institute VARCHAR(50)
)
CREATE OR REPLACE TYPE AuthorTable AS TABLE OF AuthorType;
CREATE TABLE Authors OF AuthorType;
CREATE OR REPLACE TYPE AuthorRefType AS TABLE OF REF AuthorType;
CREATE OR REPLACE TYPE PaperType AS OBJECT (
title VARCHAR(150),
language VARCHAR(2),
section REF SectionType,
authors AuthorRefType,
MEMBER FUNCTION has_authors(authorName IN CHAR) RETURN INTEGER
)
CREATE TABLE PaperTable OF PaperType (
FOREIGN KEY (section) REFERENCES SectionTable
)
NESTED TABLE authors STORE AS AuthorRefTable;
INSERT INTO PaperTable VALUES
SELECT 'Services in the digital era: How the role of customers changes with the adoption of new technologies', 'EN', REF(section),
AuthorRefType(
(SELECT REF(a) FROM Authors a WHERE email = 'zs.kenesei@gmail.com'),
(SELECT REF(a) FROM Authors a WHERE email = 's.seuring@gmail.com')),
FROM SectionTable section WHERE section = 'Marketing';