tschf / dmdump

The Unlicense
4 stars 1 forks source link

Packages ddl gets space added to the opening line #5

Open tschf opened 8 years ago

tschf commented 8 years ago
SQL> CREATE OR REPLACE PACKAGE "HR"."FOO2"
  2  as
  3      bar NUMBER := 1;
  4  end foo2;
  5  /

Package FOO2 compiled

SQL> spool output.sql
SQL> ddl foo2
  CREATE OR REPLACE PACKAGE "HR"."FOO2" 
as
    bar NUMBER := 1;
end foo2;
/
SQL> spool off
SQL> exit

Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

image

zhudock commented 7 years ago

Not sure how to fix this via the DLL command, but if changed to use dbms_metadata.get_ddl, the output can be wrapped in an ltrim to remove leading spaces and newlines

select ltrim(dbms_metadata.get_ddl(objectType, objectName), ' ' || chr(10) || chr(13)) from dual;