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
Why query optimization is needed?
What is keys and its types?
What are the different set operators available in sql?
Why is nosql good?
how can we find the number of rows in a table using mysql? : Sql dba
What are the most important characteristics of pl/sql?
what is cross join? : Sql dba
Is primary key clustered or nonclustered?
what is the use of anchoring object? what r the difference between anchoring object & enclosing object? can any one tell me all the details?
what is user defined functions? : Sql dba
What are the main features of cursor?
How do you select unique values in sql?
What does the file extension accdb stand for?
What are pl/sql cursors?
What is scalar and vector?