【问题标题】:How to insert Oracle Collection data into CLOB Column of a table如何将 Oracle 集合数据插入表的 CLOB 列
【发布时间】:2021-07-16 16:52:45
【问题描述】:

我在集合变量中有记录。 O 想将所有记录插入到表的 CLOB 列中。

    set serveroutput on;
declare
    type ROW_DATA is table of varchar2(256) ;
    ROW_D ROW_DATA;
begin
    with DIFF_TAB_DATA as
    (
    select SOME_COLUMN from SOME_TABLE1
    union all
    select SOME_COLUMN from SOME_TABLE2
    union all
    select SOME_COLUMN from SOME_TABLE3
    union all
    select SOME_COLUMN from SOME_TABLE4
    union all
    select SOME_COLUMN from SOME_TABLE5
    )
    select SOME_COLUMN bulk collect into ROW_D from DIFF_TAB_DATA;
    insert into CLOB_TAB values(ROW_D);
end;

但是我得到了本地集合变量不能在插入语句中使用的错误。

【问题讨论】:

    标签: sql oracle plsql types


    【解决方案1】:

    是的,这是一个不匹配本地集合类型不能替换为当前值的数据类型,它们是完全不相关的。而是将集合与索引集一起调用以提取存储在其中的值。为了执行此操作,只需替换

    INSERT INTO clob_tab VALUES(row_d);
    

    FORALL indx IN 1 .. row_d.COUNT
    INSERT INTO clob_tab VALUES(row_d(indx));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-05
      • 1970-01-01
      相关资源
      最近更新 更多