我的任务是修改一个包,在这样做时,我注释掉要修改的行以保留版本并用版本号对其进行评论。
现在我已经完成了对Package的修改,我想比较原始修改脚本的代码行总数而没有行注释。
在SQL Developer / Notepad ++ / PL / SQL Developer或任何其他免费软件/在线工具中是否有此功能可用?
提前致谢!
答案 0 :(得分:0)
你有备份包和克隆包吗?然后你可以使用“超越比较”工具。它对于文本文件的拼写非常有用。您可以打开备份包和克隆包,然后轻松找到代码中的更改。
最好的问候
答案 1 :(得分:0)
答案 2 :(得分:0)
基于我的一篇帖子 -
SQL/Regex Challenge/Puzzle: How to remove comments from SQL code (by using SQL query)?
create or replace package dmarkovitz.old_code as
1
2 2
3
/* yada yada yada */
4
5 '-- not a comment '
6
-- bla bla bla
7
8 "/* also not a comment"
9
10 'and again, not a comment */'
end;
/
create or replace package dmarkovitz.new_code as
1
2 /* bla bla bla */ 2
-- 3
/* yada yada yada */
4
5 '-- not a comment '
/*6
-- bla bla bla
7
8 "/* also not a comment"
9 */
10 'and again, not a comment */'
end;
select owner
,object_name
,object_type
,ddl
,uncommented_ddl
,regexp_count (uncommented_ddl,chr(10)) as lines
from (select owner
,object_name
,object_type
,ddl
,regexp_replace (ddl,'(''.*?''|".*?")|/\s*\*.*?\*/\s*|\s*--.*?(?=$|\z)','\1',1,0,'mn') as uncommented_ddl
from (select owner
,object_name
,object_type
,dbms_metadata.get_ddl (object_type,object_name,owner) as ddl
from all_objects
where owner = 'DMARKOVITZ'
and object_name in ('OLD_CODE','NEW_CODE')
and object_type = 'PACKAGE'
)
)
;
OWNER OBJECT_NAME OBJECT_TYPE DDL UNCOMMENTED_DDL LINES
---------- ----------- ----------- ---- --------------- -----
DMARKOVITZ NEW_CODE PACKAGE CLOB CLOB 8
DMARKOVITZ OLD_CODE PACKAGE CLOB CLOB 13
CREATE OR REPLACE PACKAGE "DMARKOVITZ"."OLD_CODE" as
1
2 2
3
4
5 '-- not a comment '
6
7
8 "/* also not a comment"
9
10 'and again, not a comment */'
end;
CREATE OR REPLACE PACKAGE "DMARKOVITZ"."NEW_CODE" as
1
2 2
4
5 '-- not a comment '
10 'and again, not a comment */'
end;