2016-11-18 135 views
1

我是oracle pl sql的新手。 有一個表(tableA)與blob列,我想要獲得此列,使用utl_compress.lz_compress(blob_column)壓縮它,然後使用過程將此列插入'tableB'中。 我嘗試了一些方法來做到這一點,但我得到'壞論調'的錯誤。 非常感謝。如何使用utl_compress.lz_compress壓縮blob列並將其插入到另一個表中

編輯:我需要一些這樣的事

procedure myProcedure as 
begin 
    FOR myrectype IN (SELECT * FROM tableA) 
    LOOP 
    insert into tableB(id,blob_column) values(myrectype.id,utl_compress.lz_compress(myrectype.blob_column)); 
    END LOOP 

end myProcedure; 

例外:

29261. 00000 - "bad argument" 
*Cause: A bad argument was passed to the PL/SQL API. 
*Action: Check the arguments passed to the PL/SQL API and retry the call. 
others exception with code : -29261 
others exception with mssg : ORA-29261: bad argumen 
+0

它始終是有益的張貼你寫的代碼,你得到了錯誤堆棧(確切的Oracle錯誤消息,並且表示在拋出的錯誤的行錯誤堆棧)。 –

+0

@JustinCave,謝謝你的回覆,我添加了一個我需要的樣本,在上面的示例中,我得到'ORA-29261:bad argument' – mohammad

回答

0

我解決that.need存儲utl_compress.lz_compress(myrectype.blob_column )在變量first.I更改程序爲:

procedure myProcedure as 
v_blob_column blob; 
begin 
    FOR myrectype IN (SELECT * FROM tableA) 
    LOOP 
    v_blob_column := utl_compress.lz_compress(myrectype.blob_column); 
    insert into tableB(id,blob_column) values(myrectype.id,v_blob_column); 
    END LOOP 

end myProcedure; 

感謝

相關問題