Oracle apex APEX 3.2:将数据从.CSV导出到Oracle DB
顶点3.2 甲骨文11 我的要求是创建一个GUI进程,允许用户加载一个.CSV文件,该文件只有4列,可能有多行。然后使用.CVS文件中的相应数据更新数据库中的数据表Oracle apex APEX 3.2:将数据从.CSV导出到Oracle DB,oracle-apex,Oracle Apex,顶点3.2 甲骨文11 我的要求是创建一个GUI进程,允许用户加载一个.CSV文件,该文件只有4列,可能有多行。然后使用.CVS文件中的相应数据更新数据库中的数据表 CSV file: ID Number: Field Name: Channel: Analyst: 123456 Title Retail John Smith 123456 City Retail John Smith Current DB: ID N
CSV file:
ID Number: Field Name: Channel: Analyst:
123456 Title Retail John Smith
123456 City Retail John Smith
Current DB:
ID Number: Field Name: Channel: Analyst:
123456 Title Retail (null)
123456 City (null) (null)
After Update DB
ID Number: Field Name: Channel: Analyst:
123456 Title Retail John Smith
123456 City Retail John Smith
欢迎提供任何想法或链接。提供文件浏览项目,将您的文件上载到wwv\u flow\u文件 然后解析BLOB内容,请参见以下链接: 这些评论也值得一读。例如,提到了Alexendria PLSQL实用程序库。这个库包含很多基于plsql的工具,值得一看 (引自莫顿在博客上的评论) 克里斯 正如我指出的,csv_util_pkg包的最新版本可以 可以在亚历山大图书馆找到,这确实支持 可选的封闭值 我刚刚用您的示例数据进行了测试:
select * from table(csv_util_pkg.clob_to_csv(‘normal,”commas,,,in the
field”,”"”enclosed”"”,”random “” double “” quotes”,”commas,,, “” and
double “”"” quotes”‘))
这会将数据分成5列:
c001 = normal c002 = commas,,,in the field c003 = “enclosed” c004 =
random ” double ” quotes c005 = commas,,, ” and double “” quotes
(我想我应该从博客文章中删除旧代码,然后
指导用户下载最新的库代码。)
- 莫顿
function blob_to_clob( p_lob in blob ) return clob is
l_clob_result clob := 'X';
l_dest_offsset integer := 1;
l_src_offsset integer := 1;
l_lang_context integer := dbms_lob.default_lang_ctx;
l_warning integer;
begin
if p_lob is not null and length(p_lob) > 0 then
dbms_lob.converttoclob(dest_lob => l_clob_Result,
src_blob => p_lob,
amount => dbms_lob.lobmaxsize,
dest_offset => l_dest_offsset,
src_offset => l_src_offsset,
blob_csid => dbms_lob.default_csid,
lang_context => l_lang_context,
warning => l_warning);
if l_warning != 0 then
dbms_output.put_line('Function blob_to_clob warning:' || l_warning);
return null;
end if;
return l_clob_result;
else
return null;
end if;
exception
when others then
dbms_output.put_line('Function blob_to_clob error:' || SQLCODE);
return null;
end blob_to_clob;