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
Which table is left in join?
What is the use of & in pl sql?
How do you select unique values in sql?
What is rtm stands for?
How would you convert date into julian date format?
What is pl sql script?
Is a secondary key the same as a foreign key?
Is left join inner or outer?
What is sql profiling in oracle?
What does the acronym acid stand for in database management?
What are pl sql data types?
What is the difference between delete, truncate and drop command?
explain normalization concept? : Sql dba
What is basic structure of pl sql?
What is sql and also describe types of sql statements?