Search notes:

SQLPATH - getcode

getcode.sql creates a file with the source code of a given PL/SQL object (such as a PL/SQL package, function or procedure).
-- 
--  Found on https://github.com/timwarnock/sqlpath
--
--  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
Github repository Oracle-SQLPATH, path: /getcode.sql

See also

dba_source

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1741097376, '3.142.35.211', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/SQL-Plus/sqlpath/getcode(78): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78