Declare
Cursor r_sdvx Is
Select t.xsd_name
,t.xsd_content_blob
From cms_setup_declaration_version_xsds_cu t
Where t.xsd_name = 'DMS.Declaration_1p10.xsd';
l_rec r_sdvx%Rowtype;
l_lsize Number;
l_bsize Number := 1005;
t_varchars dbms_sql.varchar2_table;
Procedure pl##(i_what In Varchar2) Is
Begin
dbms_output.put_line(i_what);
End pl##;
Begin
Open r_sdvx;
Fetch r_sdvx
Into l_rec;
Close r_sdvx;
l_lsize := dbms_lob.getlength(l_rec.xsd_content_blob);
For ii In 0 .. ceil((l_lsize / l_bsize) - 1)
Loop
t_varchars(ii + 1) := dbms_lob.substr(l_rec.xsd_content_blob
,l_bsize
,ii * l_bsize + 1);
End Loop;
-- add template blob to script
pl##('wwv_flow_api.g_varchar2_table := wwv_flow_api.empty_varchar2_table;');
For ii In 1 .. t_varchars.count
Loop
pl##(' wwv_flow_api.g_varchar2_table(' || ii || ') := ''' || t_varchars(ii) || ''';');
End Loop;
End;
/
Declare l_blob Blob;
Begin
wwv_flow_api.g_varchar2_table := wwv_flow_api.empty_varchar2_table;
wwv_flow_api.g_varchar2_table(1) := '3C3F786D6C2076657273696F6E3D22312E302220656E ';
l_blob := wwv_flow_api.varchar2_to_blob(p_varchar2s => wwv_flow_api.g_varchar2_table);
Insert Into cms_setup_declaration_version_xsds_cu
(xsd_name
,sdve_cu_id
,created_on
,created_by
,xsd_content_blob)
Values
('ISO3AlphaCurrencyCode_2012-08-31.xsd'
,1
,current_timestamp
,User
,l_blob);
Commit;
End;
/