簡體   English   中英

如何將 Oracle 集合數據插入表的 CLOB 列

[英]How to insert Oracle Collection data into CLOB Column of a table

我在集合變量中有記錄。 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;

但是我得到了本地集合變量不能在插入語句中使用的錯誤。

是的,這是一個不匹配 本地集合類型不能替換為當前值的數據類型,它們是完全不相關的。 而是將集合與索引集一起調用以提取存儲在其中的值。 為了執行此操作,只需更換

INSERT INTO clob_tab VALUES(row_d);

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM