Copying LONGs between tables
Date: Wed, 2 Dec 1992 00:08:41 GMT
Message-ID: <1992Dec2.000841.3250_at_splunge.uucp>
In article <By89D6.BpI_at_well.sf.ca.us>, mharper_at_well.sf.ca.us (Michael J. Harper)
writes:
> I need to copy the contents of a table into another table. Sounds easy,
> right? Well, my problem is that one of the columns in the source table
> is bound to be a LONG or LONG RAW, and the following syntax:
>
> INSERT INTO NEWTAB
> SELECT COL_A, COL_B, COL_LONG
> FROM OLDTAB
>
> fails with the error message:
>
> ORA-00997: illegal use of LONG datatype
I too have been trying to achieve this using something other than COPY from SQL*Plus. I found, as Scott Stephens from Oracle points out, that it must be done by retrieving the value into a local variable and then inserting this variable into the new table. The trouble is that my copy facility must be generic and I do not want to dynamically allocate storage for a variable number of columns. It is, however, almost elegant to retrieve the long field seperately as with:
Select long_col into :long_field from Oldtab where ...
and then copy the record as with:
Insert into newtab(colA,colB,long_col) select colA,colB,:long_field
From Oldtab Where ...
Unfortunately, Oracle spews out a 1401 error ("Inserted value too large for
column") when the field is larger than 255 characters. In my mind the above
statements should be legal. I have not found anything in the manuals that
-- Russ Bryant russ_at_splunge.uucp or kakwa!atlantis!splunge!russReceived on Wed Dec 02 1992 - 01:08:41 CET