The easiest way to "copy" a LONG data into a VARCHAR2 column is via PL/SQL.
For instance, the following anonymous PL/SQL block copies a LONG column from
table LONGTABLE into a VARCHAR2 column from table VARCHARTABLE, with the
assumption that LONGTABLE.LONGCOLUMN does not exceed 2000 bytes in length:
declare
string varchar2(2000);
character char(1);
begin
select longcolumn, pk into string, character from longtable;
insert into varchartable values (string, character);
end;
<B>OR USE THE COPY COMMAND </B>
You already have data in a table with a long column, and you want to change
that column from long to varchar2.
If you try the copy command, you will get the error 'CPY0005: Source and
destination column attributes don't match' if the destination tables's column
is not the same as the source tables.
First 'set COPYTYPECHECK off' and then you will be able to use the copy
command.
SQL> SET COPYTYPECHECK OFF
SQL> SET LONG 2000
SQL> copy from jack/jack@T:wrvms:v7test -
> insert dummy USING -
> select x,y from test;
Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)
1 rows selected from jack@T:wrvms:v7test.
1 rows inserted into DUMMY.
1 rows committed into DUMMY at DEFAULT HOST connection.XX