Toad World® Forums

CREATE SCRIPT for Package Body corrupts the code

TOAD 11.6.1.6
Oracle 11g client

With a package body definition where there are multiple space characters between the keyword PACKAGE and BODY, and with the ‘Schema name’ option checked under Script Options, the generated code corrupts the package body name.

e.g.

CREATE OR REPLACE PACKAGE testpkg IS
PROCEDURE testproc;
END;
/

CREATE OR REPLACE PACKAGE BODY testpkg IS <-- 2+ spaces between PACKAGE and BODY
PROCEDURE testproc AS
BEGIN
NULL;
END;
END;
/

Now, from the Schema Browser, if you right click on the package name and select Create Script, check the ‘Schema name’ option, and then click OK, the output for the package body will be corrupted.

e.g.

Prompt Package TESTPKG;

CREATE OR REPLACE PACKAGE MYSCHEMA.testpkg IS
PROCEDURE testproc;
END;
/
SHOW ERRORS;
Prompt Package Body TESTPKG;
CREATE OR REPLACE PACKAGE BODY MYSCHEMA.Y testpkg IS <-- corrupted; this varies according to length of schema name and number of spaces
PROCEDURE testproc AS
BEGIN
NULL;
END;
END;
/
SHOW ERRORS;

Has this been fixed in later releases?

I tested this with Toad 11.6 and reproduced the problem. I don’t have 12.0 handy to test with, but I tested it in 12.1 as well as the current beta, and the problem didn’t happen in either of those. So it must have been fixed for either 12.0 or 12.1.

Thanks, I’ll see if I can persuade the infrastructure team to upgrade us …