我正在使用以下過程來包裝PL/SQL代碼。SYS.DBMS_DDL.WRAP不允許編譯指示和intctx
declare
l_source DBMS_SQL.VARCHAR2A;
l_wrap DBMS_SQL.VARCHAR2A;
l_wrap1 clob;
typ_ibt utl_file.file_type;
cnt number := 0;
v_directory varchar2(400) := 'd:\ftpedi\eqpm\eqpm_hold\';
cursor cur_name_get is
select distinct name object_name,type object_type
from user_source
where type = 'PROCEDURE'
and name = 'PROCESS_TIME_INSERT';
cursor cut_text_get (p_type in varchar2 , p_name in varchar2) is
select replace(text,chr(10),'') text
from user_source
where type = p_type
and name = p_name;
begin
for i in cur_name_get
loop
l_source.delete;l_wrap.delete;
open cut_text_get (i.object_type,i.object_name);
fetch cut_text_get bulk collect into l_source;
close cut_text_get;
l_source (1) := 'CREATE OR REPLACE ' || l_source (1);
l_wrap := SYS.DBMS_DDL.WRAP(ddl => l_source,
lb => 1,
ub => l_source.count);
for i in 1..l_wrap.count
loop
if i = 1
then
l_wrap1 := l_wrap(i);
else
l_wrap1 := l_wrap1 || l_wrap(i);
end if;
insert into ibt_global_inter_transfer (git_process_id,git_c_1)
values (3004, l_wrap1);
end loop;
end loop;
exception when others
then
dbms_output.put_line('sqlerrm '||sqlerrm||dbms_utility.format_error_backtrace);
end;
上述程序扭曲正常的程序,但不允許像「用法」的特殊字符。
下面是示例過程,它不包裝。
CREATE OR REPLACE
PROCEDURE xml_insert (p_in_xml in xmltype ,p_status out varchar2,p_message out varchar2) is
intctx DBMS_XMLSTORE.ctxtype;
rows number;
begin
p_status := 'S';
p_message := 'Success';
intctx := Dbms_xmlstore.newcontext('IBT_GLOBAL_INTER_TRANSFER');
dbms_xmlstore.clearupdatecolumnlist(intctx);
dbms_xmlstore.setupdatecolumn(intCtx,'GIT_PROCESS_ID');
dbms_xmlstore.setupdatecolumn(intCtx,'GIT_SESSION_ID');
rows := Dbms_xmlstore.insertxml(intctx,p_in_xml);
dbms_xmlstore.closecontext(intctx);
exception when others
then
p_status := 'R';
p_message := sqlerrm||dbms_utility.format_error_backtrace;
return;
end;
任何人都可以幫忙嗎?
它適用於我的12.1.0.1.0。然而,我不得不做一些小的修改來運行你的代碼,比如改變'name ='PROCESS_TIME_INSERT';',添加'pragma',並用dbms_output替換插入。如果這是一個解析錯誤,那麼這些細微的更改可能會產生很大的差異。你能稍微修改你的代碼,以便其他人可以測試100%相同的版本嗎? –
Hi @jonearles,你可以發佈修改後的代碼作爲解決方案,以便我可以在上面的代碼片段中看到所做的更改。 – Sravan
@Sravan:我添加了代碼作爲答案。 –