Question: SQL trigger, that should be named BI_FILM_LANG, to append text to the description of every new film inserted into the database. It is based on


 SQL trigger, that should be named BI_FILM_LANG, to append text to the description of every new film inserted into the database. It is based on the language (language_id) and the original language (original_language_id) of the film. The format of the text you append should be (replacing tokens): Originally in . Re-released in . Original language and language should be the name of the language from the language table.

film_category film_id category_id film film id category category_id name title description release_year 

For example: If the following query was run: INSERT INTO FILM (title, description, language_id, original_language_id ) VALUES ('B Movie', 'Movie about wasps.', 1, 2); It should produce the following when the following select statement is run (based on the script file provided to you and assuming B Movie's id is 9999999): SQL> SELECT description FROM FILM WHERE film_id = 9999999; description--- Movie about wasps.Originally in Italian. Re-released in English. I have genrated this sql statement but its showing errors


CREATE OR REPLACE TRIGGER "BI_FILM_LANG"

 BEFORE INSERT ON "FILM" 

FOR EACH ROW

 BEGIN

 SELECT (CONCAT(OLD.DESCRIPTION,'.Originally in ',

 (TO_CHAR(SELECT LANGUAGE.NAME FROM LANGUAGE , FILM  

WHERE LANGUAGE.LANGUAGE_ID = FILM.LANGUAGE_ID)),

 '.Re-released in ',

 (TO_CHAR(SELECT LANGUAGE.NAME FROM LANGUAGE , FILM 

WHERE LANGUAGE.LANGUAGE_ID = FILM.ORIGINAL_LANGUAGE_ID))))

 INTO :NEW.DESCRIPTION FROM DUAL;

 END;

 /

film_category film_id category_id film film id category category_id name title description release_year language_id original language_id rental_duration rental_rate film_actor actor_id film_id language language id name length actor replacement cost actor id rating first_name special_features last_name

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!