I have the following SQL Script: CREATE OR REPLACE TRIGGER SCSP_VIEW_UPDATE INSTEAD OF UPDATE ON SCSP_VIEW FOR EACH ROW BEGIN IF :OLD.StudentFirstName <> :NEW.StudentFirstName THEN UPDATE SECTION SET StudentFirstName = :NEW.StudentFirstName WHERE StudentID = :OLD.StudentID; END IF; IF :OLD.StudentLastName <> :NEW.StudentLastName THEN UPDATE SECTION SET StudentLastName = :NEW.StudentLastName WHERE StudentID = :OLD.StudentID; END IF; IF :OLD.CourseName <> :NEW.CourseName THEN UPDATE SECTION SET CourseName = :NEW.CourseName WHERE CourseID = :OLD.CourseID; END IF; IF :OLD.SectionName <> :NEW.SectionName THEN UPDATE SECTION SET SectionName = :NEW.SectionName WHERE SectionID = :OLD.SectionID; END IF; IF :OLD.ProfessorFirstName <> :NEW.ProfessorFirstName THEN UPDATE SECTION SET ProfessorFirstName = :NEW.ProfessorFirstName WHERE ProfessorID = :OLD.ProfessorID; END IF; IF :OLD.ProfessorLastName <> :NEW.ProfessorLastName THEN UPDATE SECTION SET ProfessorLastName = :NEW.ProfessorLastName WHERE ProfessorID = :OLD.ProfessorID; END IF; END; I am trying to figure out how to add logic so that blanks and empty strings cannot be used to update these columns, and to add a condition that unassigns a professor from a section (UPDATE SectionID) when both the Professor's first and last names are blank or empty strings

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter6: Additional Database Objects
Section: Chapter Questions
Problem 6HOA: A new table has been requested to support tracking automated emails sent to customers. Create the...
icon
Related questions
Question
100%

I have the following SQL Script:

CREATE OR REPLACE TRIGGER SCSP_VIEW_UPDATE

INSTEAD OF UPDATE ON SCSP_VIEW FOR EACH ROW

BEGIN

IF :OLD.StudentFirstName <> :NEW.StudentFirstName THEN

UPDATE SECTION SET StudentFirstName = :NEW.StudentFirstName

WHERE StudentID = :OLD.StudentID;

END IF;

IF :OLD.StudentLastName <> :NEW.StudentLastName THEN

UPDATE SECTION SET StudentLastName = :NEW.StudentLastName

WHERE StudentID = :OLD.StudentID;

END IF;

IF :OLD.CourseName <> :NEW.CourseName THEN

UPDATE SECTION SET CourseName = :NEW.CourseName

WHERE CourseID = :OLD.CourseID;

END IF;

IF :OLD.SectionName <> :NEW.SectionName THEN

UPDATE SECTION SET SectionName = :NEW.SectionName

WHERE SectionID = :OLD.SectionID;

END IF;

IF :OLD.ProfessorFirstName <> :NEW.ProfessorFirstName THEN

UPDATE SECTION SET ProfessorFirstName = :NEW.ProfessorFirstName

WHERE ProfessorID = :OLD.ProfessorID;

END IF;

IF :OLD.ProfessorLastName <> :NEW.ProfessorLastName THEN

UPDATE SECTION SET ProfessorLastName = :NEW.ProfessorLastName

WHERE ProfessorID = :OLD.ProfessorID;

END IF;

END;

I am trying to figure out how to add logic so that blanks and empty strings cannot be used to update these columns,

and to add a condition that unassigns a professor from a section (UPDATE SectionID) when both the Professor's first and last names are blank or empty strings

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning