Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Long Data Type records Insert into Table.

Posted on 2004-10-05
7
Medium Priority
?
968 Views
Last Modified: 2012-06-22
How to copy the records from a table which has LONG Data type to another Table of the same structure.

From

Table1(
X varchar2(100)
Y number(10)
Z LONG )

copy to

Table2(
X varchar2(100)
Y number(10)
Z LONG )

Thanking in Advance...!
0
Comment
Question by:UMESHNC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 23

Expert Comment

by:seazodiac
ID: 12225542
try:

insert into Table2 select * from Table1;
0
 
LVL 15

Expert Comment

by:andrewst
ID: 12225836
> insert into Table2 select * from Table1;

Thst will give the error:
ORA-00997: illegal use of LONG datatype
0
 
LVL 15

Expert Comment

by:andrewst
ID: 12225875
You can:
- use the COPY command
- Write a PL/SQL program to do it, provided all the long values are <= 32K
- Write a Pro*C program to do it
- Convert it to CLOB:
create table Table2(
X varchar2(100)
Y number(10)
Z CLOB );

insert into Table2 select X, Y, TO_LOB(Z) from Table1;
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 1

Expert Comment

by:wemy
ID: 12225963
In 8i you should not be using LONGS (long raws) they are deprecated types.

There are many restrictions with them -- this is one of them (not so with
CLOBS/BLOBS)

but you can use COPY command as the following:

SQL> copy from User_Name/Password@DB1 insert Table2 (X, Y, Z ) using select X,Y,Z from Table1;

or in the same Schema:

SQL> copy TO Table2 (X, Y, Z ) using select X,Y,Z from Table1;
 and you will be asked about the password of the TO DB.
 
You'll want to set

set arraysize N -- amount of rows the copy command will copy with each fetch
set long N -- size of your longest long
set copycommit M -- number of fetches to do before commit (N*M rows!!)
 
in plus before doing this.  see the manual for all the options....
0
 
LVL 9

Expert Comment

by:konektor
ID: 12226141
what about using export and import ? ...
0
 

Author Comment

by:UMESHNC
ID: 12226227
I am Using Oracle 9.2 release... but there are tables created when 8/8i was there .

Now how can i convert this tables which has long column into CLOB/BLOB.
Will this convertion effect any of my data in tables.


0
 
LVL 23

Accepted Solution

by:
seazodiac earned 375 total points
ID: 12226271


In Oracle9i , you can use this one-liner to change long column to LOB:

"alter table <table_name> modify <long col name>  CLOB"


this will not affect any of your data.
 
 
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question