How to maintain the history of code changes of pl/sql?
Answer Posted / guru
--
CREATE TABLE SOURCE_HIST -- Create
history table
AS SELECT SYSDATE CHANGE_DATE, USER_SOURCE.*
FROM USER_SOURCE WHERE 1=2;
CREATE OR REPLACE TRIGGER change_hist --
Store code in hist table
AFTER CREATE ON SCOTT.SCHEMA --
Change SCOTT to your schema name
DECLARE
BEGIN
if DICTIONARY_OBJ_TYPE in ('PROCEDURE', 'FUNCTION',
'PACKAGE', 'PACKAGE BODY', 'TYPE')
then
-- Store old code in SOURCE_HIST table
INSERT INTO SOURCE_HIST
SELECT sysdate, user_source.* FROM USER_SOURCE
WHERE TYPE = DICTIONARY_OBJ_TYPE
AND NAME = DICTIONARY_OBJ_NAME;
end if;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20000, SQLERRM);
END;
/
show errors
--
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
Write an sql query to select all records from the table?
What is varchar sql?
What is delimiter in pl sql?
Why is sql*loader direct path so fast?
Explain spool.
what are the authentication modes in sql server? How can it be changed? : Sql dba
list out some tools through which we can draw e-r diagrams for mysql. : Sql dba
What are pl/sql packages?
How many joins can you have in sql?
What is mutating sql table?
How do you select unique values in sql?
Is it possible to pass parameters to triggers?
What is mutating table error?
Is like operator in sql case sensitive?
What is application trigger?