Toad World® Forums

request: Trim spaces in the end


#1

in 5.5 when saving you would get a trim of spaces in the end (for instance in editing packages) in 6.0 and 6.1 beta that is not made.

Problem: DBMS_METADATA.get_ddl has a bug (at least I think is a bug) that if the object ends in space it will put the SQLTERMINATOR without using the chr(10) before.

for instance gives
end procedure_a ; /
and not
end procedure_a ;
/

that way the ouput cannot be used in a script

We never had enconter that problem before because 5.5 trims.

can you make 6.1 having the same trim as 5.5?

thanks

Filipe Silva


#2

Hi Filipe,

Both should give you the same result as they both return data grom Oracle. I tried to add spaces at the end of the object but I didn’t see any different between 5.5 and 6.0 versions. In fact, it doesn’t even add / at the end. You weren’t talking about the Extracted DDL function in navigator right? In this case some snapshots will be helpful.

Gwen


#3

execute DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA.SESSION_TRANSFORM,‘SQLTERMINATOR’,true);

select DBMS_METADATA.get_ddl (‘PROCEDURE’,‘A3’) from dual;

with 6.* with a space after the ; will get

CREATE OR REPLACE PROCEDURE “A3”
IS
BEGIN
HTP.tableopen (cattributes => ‘class=“tabela”’);
HTP.tablerowopen (cattributes => ‘valign=“TOP”’);
HTP.tabledata (HTF.bold (‘aa’));
HTP.tablerowclose;
HTP.tableclose;
END; /

also using formatter

CREATE OR REPLACE PROCEDURE “A3”
IS
BEGIN
HTP.tableopen (cattributes => ‘class=“tabela”’);
HTP.tablerowopen (cattributes => ‘valign=“TOP”’);
HTP.tabledata (‘qqqq’);
HTP.tabledata (HTF.bold (‘aa’));
HTP.tablerowclose;
HTP.tableclose;
END;
/*ADVICE(13): END of program unit, package or type is not labeled [408] /
/
Formatted on 5-Dez-2008 18:50:28 (QP5 v5.119.811.4010) */ /

with 5.5

CREATE OR REPLACE PROCEDURE “A3”
IS
BEGIN
HTP.tableOpen (cattributes => ‘class=“tabela”’);
HTP.tableRowOpen (cattributes => ‘valign=“TOP”’);
HTP.tabledata (‘qqqq’);
HTP.tabledata (HTF.bold (‘aa’));
HTP.tableRowClose;
HTP.tableClose;
END
/*ADVICE(19): END of program unit, package or type is not labeled [408] */
;
/

Even if you clean the space after the ; with 6.* (sometimes) the editor will not show the space but editing with 5.5 will show that the space is still there


#4

Hi Filipe,

It seems that the query returns different results when I edit the procedure in 5.5 and 6.*
If I add the spaces using 5.5 the / will be on a seperate line. If I use 6.*, it will be on the same line. I will log a CR so Roman can investigate more.

Gwen


#5

As I told you check the user_source table for to see the last line of the code and you will see a space even when the editor do not show it (after we try to delete it).
The 5.5 can “see” the space and you can delete it, the formatter or the save feature also automatically cleans these lasts spaces


#6

Hi Gwen/Roman

Any news?

My team is still using 5.5 due to that :frowning:

Thanks


#7

Hi Filipe,

I made a fix so trailing spaces are trimmed when saving a program. The fix will be included in the next release (we plan a patch early next year).

Regards,
Roman


#8

Thanks

I will be waiting for it!

Filipe Silva