BJCooperIT
Programmer
Once again I have to find a back door approach to do my job due to lack of privileges - arrrrghhhh! The DBA group has decided that developers, in the development database, can see the source of procedures and functions, but not packages. Don't ask why, I don't know. They only say that if I need to see the source then I can get it from the database.
I am almost there with the following script, but there is one tiny problem to overcome. When then source has embedded tabs, the extracted source shows without the indention.
The output of a function (not mine) shows like:
Replace and translate don't seem to help me take the tab and translate it to spaces so the the code is readable. It should be:
I can't write my own function for this because we need to use this in a database where I have no privileges. Is there any Oracle function or trick you can think of to do this?
Beware of false knowledge; it is more dangerous than ignorance. ~George Bernard Shaw
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
My website: www.EmuProductsPlus.com
I am almost there with the following script, but there is one tiny problem to overcome. When then source has embedded tabs, the extracted source shows without the indention.
Code:
SET echo OFF
SET verify OFF
SET feed OFF
SET head OFF
SET show OFF
SET linesize 100
SET pagesize 0
accept in_owner prompt "Enter Owner Name: "
accept in_name prompt "Enter Source Name: "
accept in_type prompt "Enter Type Name: "
col text format a100 heading "Source Text" word_wrapped
spool extract_source.lst
SELECT text
FROM all_source src
WHERE src.owner = nvl(upper('&in_owner'),src.owner)
AND src.NAME = upper('&in_name')
AND src.TYPE = nvl(upper('&in_type'),src.TYPE)
ORDER BY src.owner, src.NAME, src.TYPE, src.line;
spool OFF
edit extract_source.lst
Code:
function addmonth (inmonth number)
return varchar2 IS
BEGIN
if inmonth > 0 THEN
return add_months(sysdate,inmonth);
end if;
exception
when others THEN
return '000';
end addmonth;
Code:
function addmonth (inmonth number)
return varchar2 IS
BEGIN
if inmonth > 0 THEN
return add_months(sysdate,inmonth);
end if;
exception
when others THEN
return '000';
end addmonth;
Beware of false knowledge; it is more dangerous than ignorance. ~George Bernard Shaw
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
My website: www.EmuProductsPlus.com