How to maintain the history of code changes of pl/sql?




Answers were Sorted based on User's Feedback



How to maintain the history of code changes of pl/sql?..

Answer / arup ratan banerjee

U CAN REFER ALL_SOURCE TABLE...
SELECT * FROM ALL_SOURCE WHERE OWNER='IHIS11'
AND TYPE = 'PROCEDURE';


U will get procedure body from this table

Is This Answer Correct ?    4 Yes 0 No

How to maintain the history of code changes of pl/sql?..

Answer / 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




More SQL PLSQL Interview Questions

What is offset in sql query?

0 Answers  


What are the types of queries in sql?

0 Answers  


What is the difference between left and left outer join?

0 Answers  


explain primary keys and auto increment fields in mysql : sql dba

0 Answers  


Explain dml and ddl?

0 Answers  






What is a trigger word?

0 Answers  


Can a key be both primary and foreign?

0 Answers  


What is pivot query?

0 Answers  


How to perform a loop through all tables in pl/sql?

4 Answers   MBT, Evosys,


What does over partition by mean in sql?

0 Answers  


how can i read write files from pl/sql

3 Answers  


What are the different set operators available in sql?

0 Answers  






Categories