I am having trouble working out the logic for a procedure that forms part of a greater SQL package.
PROCEDURE CreateAnAuthor (author .People.Name%TYPE, address people.Address%TYPE);
this procedure is meant to search the Author table
Create table AUTHOR(AuthorID, INT UNIQUE REFERENCES People(PersonID),
PUblished INT DEFAULT 0,
UnderReview INT DEFAULT 0);
And add an author if there is no match. If necessary, it should also create a record in People table
create table People (
PersonID INT PRIMARY KEY,
name VARCHAR 2(15),
address VARCHAR2(15),
UNIQUE (name, Address)
);
I feel I should be creating a recorfd and a cursor, but not sure if I am making a procedure more complex than it needs to be.
Can anyone help?
thanks