views:

32

answers:

1

Hello

I got a little Probelem:

Im tring, with a SP, to read datas from Table SYSADM.aaTest and put it into MYSCHEMA.aaTest now my Problem is this Table has the Type Long in it.

desc aaTest
Name                           Null     Typ
------------------------------ -------- ----------------
ID_TEST                        NOT NULL NUMBER
RELEASE                                 NUMBER 
NAME                                    VARCHAR2(50)
XML_FILE                                LONG()   

well on some XML_File's r longer then 32760 chars :/

my procedure looks like this:

create or replace
PROCEDURE  aaTest_Proc  
(  
p_persid IN person.persid%TYPE DEFAULT NULL  -- used for errormanagemant 
) 
IS 
v_errornum NUMBER   :=0; 
v_errormsg VARCHAR2(4000) :=NULL; 

BEGIN   

for rec in(
select id_patch , release, NAME , xml_file
FROM sysadm.aaTest  
)

loop


 INSERT INTO MYSCHEMA.aaTest
( id_patch , release , NAME , XML_File ) 
VALUES
( rec.id_patch , rec.release , rec.NAME , rec.xml_file );

End loop;

Exception
…

is there a way to read them complitly out and write it back to the other table? btw this version works with files lower then 32k char but more will get an error

btw2: i know CLOB would be better, but im not able to change the Column to CLOB so i need to stay with Long :/

thats for ur help Auro

+2  A: 

Hi Auro,

you can not insert a LONG larger than 32k with pl/sql. You can use the COPY command from SQL*Plus to move LONGs.

See also:

how to select and insert a long type column

Vincent Malgrat
damit i hoped that there is a way but it looks like i need to do an update over a programm... :/
Auro
@Auro: Unfortunately yes, you will have to find a workaround: you will have to use an external program (either SQL*Plus or an external procedure in java, C...)
Vincent Malgrat