1: | Can a trigger be altered? |
A1: | No, the trigger must be replaced or re-created. |
2: | When a cursor is closed, can you reuse the name? |
A2: | This is implementation-specific. In some implementations, the closing of the cursor will allow you to reuse the name and even free the memory, while for other implementations you must use the DEALLOCATE statement before the name can be reused. |
3: | What command is used to retrieve the results after a cursor has been opened? |
A3: | The FETCH command. |
4: | Are triggers executed before or after an INSERT, DELETE, or UPDATE? |
A4: | Triggers can be executed before or after an INSERT, DELETE, or UPDATE. There are many different types of triggers that can be created. |
1: | Using your implementation's system catalog tables, write the SQL that creates the following SQL statements. Substitute the name of an actual object for the object names.
|
A1: |
|
2: | Write a statement to create a stored procedure that deletes an entry from the PRODUCTS_TBL table; it should be similar to the example used in this hour to insert a new product. |
A2: | CREATE PROCEDURE DELETE_PRODUCT (OLD_PROD_ID IN VARCHAR2) AS BEGIN DELETE FROM PRODUCTS_TBL WHERE PROD_ID = OLD_PROD_ID; COMMIT; END; / |
3: | Write the statement that executes the stored procedure that you created in Exercise 2 to delete the row for PROD_ID '9999'. |
A3: | EXECUTE DELETE_PRODUCT ('9999'), |