Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Guide to Linux System Command Mastery Linux/Unix
  • Jai Shree Ram Oracle
  • catting.sh Linux/Unix
  • Running select from V$ views from remote server Linux/Unix
  • SQL_PLAN.sql for checking real execution plan Oracle
  • How to choose Driver table in SQL statement Oracle
  • how to find OS block size Oracle
  • MYSQL and Oracle Comparison for Oracle DBA MYSQL
  • JSON/XML Types in Oracle Oracle
  • This is im telling Kishore Oracle
  • scripts to take listener.log backup Linux/Unix
  • Find Plan Hash value fphv.sql Oracle
  • DBMS_STATS Metalinks Notes Oracle
  • How To Transfer Passwords Between Databases (ref note: 199582.1) Oracle
  • Oracle Identifiers Oracle

CTAS with LONG Column for 7.x and 8 and 8i

Posted on 28-Nov-2005 By Admin No Comments on CTAS with LONG Column for 7.x and 8 and 8i

How to Copy Data from a Table with a LONG Column into an Existing Table

=======================================================================

Purpose:

========

The purpose of this article is to provide a working example of how to COPY

data from a table with a LONG column into another existing table with the

same structure definition. This document is especially useful for helping

avoid an ORA-997 error as you try to achive the above objective.

Scope & Application:

====================

This article is intended for use by anyone who is receiving an ORA-997

error when they try to create a new table with a LONG column from

an existing table using the ‘Create Table As Select’ (CTAS) command.

You receive the same ORA-997 error even when you try to INSERT data from

the table with a LONG column into another table with a LONG column

using the INSERT INTO … command.

The only way to resolve this problem is to use the SQL*Plus COPY command

as discussed in this article.

This article is applicable for Oracle versions 7.3.4 through 8.1.X.

How to Copy Data from a Table with a LONG Column into an Existing Table:

========================================================================

Example:

——–

$ sqlplus scott/tiger@otcsol1_v734

SQL> create table le

(c1 number,

c2 long);

SQL> desc le

Name Null? Type

——————————- ——– —-

C1 NUMBER

C2 LONG

SQL> insert into le values ( 123, ‘long column values’);

SQL> commit;

SQL> select * from le;

C1 C2

—– ————————————————–

123 long column values

SQL> create table le2

(c1 number,

c2 long);

SQL> desc le2

Name Null? Type

——————————- ——– —-

C1 NUMBER

C2 LONG

SQL> copy from scott/tiger@otcsol1_v734 to scott/tiger@otcsol1_v734 –

> append le2 –

> using select * from le;

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 scott@otcsol1_v734.

1 rows inserted into LE2.

1 rows committed into LE2 at scott@otcsol1_v734.

Notes:

——

o You must use the connect string in the FROM and TO clauses of the COPY

command as shown above.

o You must use the “-” ( dash) at the end of each line if you want to break

the command into a number of lines. Otherwise, the COPY command may fail.

o This has been tested using a V734 connect string as well as other releases.

SQL> select * from le2;

C1 C2

—– ————————————————–

123 long column values

Oracle, SQL scripts

Post navigation

Previous Post: My FTP Job Scheduling for www.pvmehta.com
Next Post: CTAS with LONG Column for 9i and higher

Related Posts

  • ORA-8031 issue and solution if it is occuring due to truncate. Oracle
  • Oracle Standby Database Library Index from Metalink Oracle
  • oracle 11g RAC on vmware Oracle
  • Oracle 10g Installation/Applying Patches Tips Oracle
  • How to know current SID Oracle
  • Import and export statements Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (342)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • ORA-8031 issue and solution if it is occuring due to truncate. Oracle
  • Difference between SYNC and AFFIRM Oracle
  • Benefits and Usage of RMAN with Standby Databases Oracle
  • fkwoindex.sql /* Find FK without Index */ Oracle
  • send email from unix mailx with attachment. Linux/Unix
  • How does one overcome the Unix 2 Gig file limit? Linux/Unix
  • ORA-4031 issue and solution on 09-MAY-2008 Oracle
  • proc.sql Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme