-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetcode.sql
More file actions
37 lines (32 loc) · 719 Bytes
/
getcode.sql
File metadata and controls
37 lines (32 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--
--
-- Creates a file with the source text of the code
-- passed as first argument. The suffix of the file
-- is .sql
--
-- If the code consists of a spec and a body, the
-- created file will contain both.
--
set feedback off
set heading off
set termout off
set linesize 1000
set trimspool on
set verify off
spool &1..sql
prompt set define off
select decode( type||'-'||to_char(line,'fm99999'),
'PACKAGE BODY-1', '/'||chr(10),
null) ||
decode(line,1,'create or replace ', '' ) ||
text text
from user_source
where name = upper('&&1')
order by type, line;
prompt /
prompt set define on
spool off
set feedback on
set heading on
set termout on
set linesize 120