Copy Long Raw

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
Post Reply
schnu
Rank: Analista Pleno
Rank: Analista Pleno
Posts: 110
Joined: Tue, 24 May 2005 9:16 pm
Location: Dongguan - Guangdong - China

I have a table q has the long raw field, and inside this field is stored figures, but I have another similar table q tb I have a long raw field, what I need to do is pass the figures that are stored in Table 1 for table 2 , but I'm having diffucades to give you the Long Raw fields, does anyone know how I can solve this ??
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Make an insert!
Example:

Select all

INSERT INTO tab1 (campo_long) (select campo_long from tabela2)
There goes a link http://en.glufke.net/oracle/viewtopic.php?t=154
gerson.vasconcelos
Rank: Estagiário Júnior
Rank: Estagiário Júnior
Posts: 1
Joined: Mon, 06 Mar 2006 8:42 am
Location: Maceió/AL
[Gerson Júnior]

Dear Dr_Gori, that in fact works, but only for BLOB fields, not for Long Raw. I am with the same difficulty as the friend, make a copy of Long Raw field, but I could not find a solution yet. Thanks for the tip, but unfortunately it does not work.
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

In fact, if you are using Bank 8 or higher, you should not be using Long Raw. It still exists only for compatibility purposes. You should be using a blob! (Hence it works the way it was indicated)

to copy from one table to another a LONG RAW field only with PL / SQL, it is half complicated:
* Make an Export of the table.
* Rename the table to the desired name using the Rename command
* Do the import you have created ...

See what Tom Kyte speaks Regarding: http://asktom.oracle.com/pls/ask/f?p=49 ... 8223421081
This cursor can be used if Long Raw has up to 32k

Select all

DECLARE 
CURSOR MyCursor IS SELECT Field1, Field2, RawField FROM Table1;  
vField1 integer; 
vField2 varchar2(50);                                                             
 
   
vRawField long raw; 
iCount integer; 
BEGIN 
iCount := 0; 
 
OPEN MyCursor; 
 
LOOP 
FETCH MyCursor INTO vField1, vField2, vRawField;  
EXIT WHEN MyCursor%NOTFOUND; 
iCount := iCount + 1;    
INSERT INTO Table2 (T2Field1, T2Field2, T2RawField)  
VALUES (vField1, vField2, vRawField);  
 
--Commit every 10 rows  
IF iCount = 10 THEN              
iCount := 0;  
COMMIT; 
END IF; 
 
END LOOP;  
COMMIT;    
CLOSE MyCursor;   
END; 
This routine is done in Java, but I believe it is not 100% tested. [[two]]
madriano74
Rank: Estagiário Júnior
Rank: Estagiário Júnior
Posts: 1
Joined: Thu, 17 Mar 2022 3:54 pm
Location: Guarapuava/PR

Topic under translation. Come back later. (This is an automatic message)
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests