My Remarks!

the Life, the Universe and almost Everything what's Left

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /mnt/web710/d2/82/51207682/htdocs/armbruster-it/joomla33/templates/stefans_blog_05/functions.php on line 182

How to copy data with "Long Raw" columns

From time to time I will be faced the problem to move data from one table to another. Under normal circumstances this is not a big deal, but if the source table contains a long-/raw column this is impossible to manage that with plain SQL. So here is a suitable workaround to solve this problem with a few lines of PL/SQL code

 

Starting point is a table with a long raw column:

1insert into long_table
2select 'new id',
3       long_column /* LONG-Feld */
4  from long_table a
5 where a.long_id = 'some old id';

This ends up with "ORA-00997: illegal use of LONG datatype error"

 

The workaround is:

01declare
02  l_rec_long_table long_table%rowtype;
03begin
04  select *
05    into l_rec_long_table
06    from long_table a
07   where a.long_id = 'some old id';
08  
09  insert into long_table
10  values
11    ('new id',
12     l_rec_long_table.long_column);
13end;

Visits

Today 43 | Week 514 | Month 1686 | All 1173875

Donalds Daily Dumbs (The Guardian)

Donald Trump | The Guardian

14 June 2025

News about Donald Trump, the 45th and 47th US president, including comment and features from the Guardian

Challenges Completed

Vätternsee Club des Cinglés du Mont-Ventoux Styrkeproven 24hVelo Belchen³ Guitar Rehearsal

StackOverflow

profile for PT_STAR at Stack Overflow, Q&A for professional and enthusiast programmers