SQL*Plus 'Copy' command and LONG datatypes

Hi. I'm using Oracle 9.2.0.5 and wanna copy LONG to LONG without using an Interface in VB or any other programming language.
Some of the fields (plain text) are greater than 32 Kb, and I tried the SQL*Plus 'Copy' command, without success.
(For compatibility reasons I can't convert LONG to CLOB, I need to copy LONG to LONG)
This is the example I'm working with:
Table Source_LONG (ID number, DATA long)
Table Destination_LONG (ID number, DATA long)
The SQL*Plus command: (connected from test_database@environment)
set long 100000
copy from test_database/test_database@environment insert destination_long (id,data)
I tried using both FROM and TO, but same results.
The fields are copied into destination_long, but they are
truncated at 32768 bytes, even with the LONG variable set to 100000. Any ideas ?
Thanks.

I'm working with 2 similar tables with this structure:
SOURCE_LONG (ID number, DATA long)
DESTINATION_LONG (ID number, DATA long)
SOURCE_LONG contains two rows:
ID DATA
1 hello
3 ....text bigger than 32kb...
I tried your solution and it insert 2 rows, but only the ID is filled. The DATA is empty in both cases :-(
insert into destination_long(id,data) (select id,to_lob(data) from source_long);

Similar Messages

  • ORA-01401 on execution SQL*Plus Copy command

    I looking solution for strange problem :
    I having two database created with AL32UTF8 character-set ; current application design are that we loading data throw SQL Loader and than transferring loaded data from one database to another using SQL*Plus copy command.
    Now , we having two tables , declared 100% identically , with respect to NLS and CHAR semantics (all varchar fields having CHAR inside length).
    At attempt to transfer data , with SQL*Plus Copy command I'm receiving next output :
    ERROR:
    ORA-01401: inserted value too large for column
    If I'm trying to transfer data via DB link , and this succeeds , or throw exp/imp utilities it also works .
    Database servers are 9.2 (i tryied with 9.2.0.6 or 9.2.0.8) ; client side were 9.2.0.8 , 10.1.0.5 ...
    On client side NLS_LANG variable are set to AMERICAN_AMERICA.AR8MSWIN1256 (we working on project who needs to support arabic language)
    Did anyone encountered same problem ? Any One ?

    it could be that the column of the table that you are trying to insert the data has a small length.

  • SQL*Plus COPY command does not work

    SQL*Plus COPY command does not work in SQL Developer. I am using SQL Developer 1.5.1 on Windows XP.
    copy from <source_db_connection> to <target_db_connection> create <target_tab_name> using select * from <source_tab_name>
    Does it work on different versions of SQL Developer ?
    Anyone had any success in trying COPY command in SQL Developer?
    Thanks in advance.

    While it hasn't been updated for v1.5, this page lists the supported SQL*Plus commands. COPY is explicitly listed as not supported.
    theFurryOne

  • SQL PLUS Copy Command

    I'm having problems with the copy command in sql plus
    Here's my command
    COPY FROM tib_oms/tib_oms@odb1 -
    TO gbonk/gbonk@stage -
    INSERT -
    gbonk.products ( id_manufacturer, id_sku, category ) -
    USING -
    select id_mfr, sku, prodcat from tib_oms.pricinghistory
    The error I receive is...
    CPY0007: Select list has fewer columns than destination table
    I'm selecting 3 columns and I'm specifing 3 columns so I don't get what's up.
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Greg Bonk ([email protected]):
    Well i gave it a shot. Here's my modified copy command....
    copy from tib_oms/tib_oms@odb1 -
    TO gbonk/gbonk@stage -
    insert -
    gbonk.products ( "ID_MANUFACTURER", "ID_SKU", "CATEGORY" ) -
    using -
    select "ID_MFR", "SKU", "PRODCAT" from tib_oms.pricinghistory;
    But I still recieve the same error. Is there anything else that I could trouble shoot?<HR></BLOCKQUOTE>
    did u check if the destination & target columns have the same structure. maybe one of the is a composite datatype (i.e varray,nested tables etc) ?
    null

  • GPF in SQL*PLUS Copy Command?

    Hello,
    I'm getting a GPF and crash of SQL*Plus when I use the copy command. Seems like I used to be able to make it work if I tried logging on to the source database before the copy, but now even that won't work. I issue the command, it looks out over the modem for the remote database, then the GPF occurs.
    copy from me/[email protected] to me/me@LocalDB -
    insert ARRG_BNDRY_OBJECT -
    using -
    SELECT * FROM ARRG_BNDRY_OBJECT WHERE ARRG_BNDRY_KEY IN -
    (80169);
    Ideas?
    Thanks,
    Dale

    You might also want to try the same command using SQL*Plus command line (DOS version). If you haven't used it before, enter SQLPLUS at the command prompt, eg:
    c:\sqlplus
    Alison

  • Help with SQL*Plus COPY Command syntax

    Hello people.
    DBs are 10g
    PROD DB is a remote DB (over DB Link)
    TEST DB is where my SQL*Plus is logged in.
    LOCAL_DB_TABLE is the table I need to create to TEST DB
    REMOTE_DB _TABLE is the table that already exists in remote PROD DB
    COPY FROM replica/replica@PROD
    CREATE LOCAL_DB_TABLE@TEST
    ROW_ID,
    CREATED,
    CREATED_BY,
    UPD,
    UPD_BY
    USING SELECT
    ROW_ID,
    CREATED,
    CREATED_BY,
    UPD,
    UPD_BY
    FROM REMOTE_DB_TABLE
    WHERE ROW_ID='XXX';The error message I am getting:
    usage: COPY FROM <db> TO <db> <opt> <table> { (<cols>) } USING <sel>
      <db>   : database string, e.g., hr/your_password@d:chicago-mktg
      <opt>  : ONE of the keywords: APPEND, CREATE, INSERT or REPLACE
      <table>: name of the destination table
      <cols> : a comma-separated list of destination column aliases
      <sel>  : any valid SQL SELECT statement
    A missing FROM or TO clause uses the current SQL*Plus connection.
    CREATE LOCAL_DB_TABLE@TEST
    ERROR at line 1:
    ORA-00901: invalid CREATE commandThank you in advance for your help.

    Hi,
    I hope you are thinking of Creating a Table with the Same Structure as the remote database Table, If so.
    You can create a Table from the Existing Table using CTAS(Create Table as Select).
    Provided, you have created a Database Links between the 2 Databases. You can create a
    table in your Schema as,
    CREATE TABLE local_db_table AS
    SELECT * FROM remote_user_name.remote_db_table@dbname;Thanks,
    Shankar
    Edited by: Shankar Viji on Jul 19, 2012 11:01 PM

  • How to Hide password when invoking sql plus from command promt?

    When i try to open sql plus in command prompt window and enter the sqlplus command follwed by username/password@connection string, the password is not hidden.
    How do I get it to show **** instead of displaying password characters out?
    Also, what is the command to clear screen : when I try cls or clear screen, I get a windows memory exception of somekind and the only option there is to kill the command window.
    Any tips on getting around this?
    Thanks a lot for your time and help.

    user8848256 wrote:
    Can you please give more details on how to not enter password when calling sqlplus from command window like you are saying?
    I tried this :
    sqlplus username/ @connection string -->Hit Enter : it asks for password but does not recognise the connectionstring to connect to.
    sqlplus username/ -->Hit Enter: It does same thing again.asks for password but gives tns adapter error after the password is entered.Leave out the slash:
    sqlplus username@connect_string

  • Help Using SQL*Plus Format Commands (like TTITLE) in Packages

    Where (within a package) can/should SQL*Plus format commands such as TTITLE, COLUMN & BREAK be coded?

    A package is coded in PL/SQL.
    TTITLE, COLUMN and BREAK are SQL*Plus commands, they cannot be used in PL/SQL.
    If you want to output data (using dbms_output) in your package, you'll have to implement the features yourself. But probably just using SQL*Plus is better in your case.
    Regards,
    Rob.

  • Preference equivalents for relevant SQL*Plus set commands?

    I know that the SQL*Plus set command is not supported in Raptor (as per http://www.oracle.com/technology/products/database/project_raptor/sql_worksheet_commands.html), but there are a number of set options that are relevant.
    For example, set define (for which "set define off" is covered in Ampersand in scripts We have a number of existing SQL scripts where we have set the define character to something apart from & to avoid issues where this is a required value in the code.
    Setting server output size is another option - as per set serveroutput on size unlimited .
    Is there any proactive plan to provide preferences equivalent to the set options that are relevant (to either SQL scripts or the various output tabs)? Or is the exclusion of the SQL*Plus set command only for the current version and it will be included later? From the discussion on the forums so far, it seems as though you are looking at each set option as it is raised, rather than being proactive about it.
    Even if Raptor does provide preferences, it would still be useful for the equivalent set commands to work. Lets say that we do get a preference for the define character - 99% of the time, scripts want this to be & - however there are some where the script wants it to be $ (or whatever). With a preference, I need to know what the script wants and change the preference before running the script and then change it back afterwards.

    Hi Turloch,
    When is this script executed ?
    In 3.1EA2 I created a sql script where a variable is defined and set this script as you suggested.
    Script:
    define varname=abc
    When I open a connection, a worksheet is automatically opened. I run this statements:
    select '&varname' from dual;
    define varname=xyz
    select '&varname' from dual;
    Running the first select statement results in a popup window for entering a value for the substitution variable, while I was expecting the value abc as the result of the query.
    See also this blog where the login script is explained.
    But in my SQL Developer 3.1EA2 64-bit on Windows 7 it doesn't work like that.
    Is this a bug?
    Dennis

  • W'azup with SQL Developer barfing on SQL*Plus "set" commands

    Check out this short script and the results it generates, as pasted below.
    I can't find anything in the SQL Dev documenation re: what SQL*Plus set commands it supports and which it considers "passe." I'm particularly puzzled by the "column ... format ..." command getting ignored.
    set heading off
    set pagesize 0
    set linesize 80
    set feedback off
    prompt ...start...
    column x format a5
    select 'abcdefghij' x from dual;
    prompt ...end...
    line 1: SQLPLUS Command Skipped: set heading off
    line 2: SQLPLUS Command Skipped: set pagesize 0
    line 3: SQLPLUS Command Skipped: set linesize 80
    ...start...
    X ----------
    abcdefghij 1 rows selected
    ...end...

    For supported SQL*Plus commands: SQL Developer Help > SQL Developer Concepts and Usage > Using the SQL Worksheet > SQL*Plus Statements Supported and Not Supported in SQL Worksheet.
    The "column ... format ...." command is not supported. A workaround is to use substr in your select statement.
    See also How to set a column size in sqldeveloper?

  • Does SQL Developer have any way to run the SQL*PLUS COPY FROM command?

    set arraysize 100;
    set copycommit 100;
    COPY FROM SCOTT/TIGER@OtherDBinstance -
    CREATE COMPANY -
    USING SELECT * from COMPANY;

    Thanks. I have been using the create table ABC as select * from ABC@otherdb but this often runs into temp segment issues for very large tables. The SQL*PLUS version allows me to have the copy commit save after each xxxxx lines and this seems to be able to handle any size table. Can copy commit be used from SQL Developer?

  • SQLplus COPY command and datatypes

    I have a view, schema1.myview:
    col1 VARCHAR2(10),
    col2 VARCHAR2(10),
    col3 NUMBER,
    col4 VARCHAR2(10)Then, using SQLplus, connected as schema2:
    COPY FROM schema1/password@mydb REPLACE myview USING SELECT * FROM myviewThe resulting table schema2.myview:
    col1 VARCHAR2(10),
    col2 VARCHAR2(10),
    col3 INTEGER,
    col4 VARCHAR2(10)Col3 has been converted from NUMBER to INTEGER and I'm losing precision. My goal is to copy this data from one schema to the other; SQLplus's COPY command seemed easy but I'm open to other possibilities that can be easily scripted.

    Thank you for your response, Sundar.
    I may try enumerating the columns at a future time, but doing so in a script is awkward, especially if source views and tables and their columns change.
    I'm not sure if a database link is what I'm wanting, as both source and target are in the same database.
    I had considered synonyms, but I don't seem to have the necessary permissions to do so.

  • Copying data contianing long datatype from one schema to another

    I'm using Oracle 8.1.7 and trying to move copy data from one schema to another.
    Usually an easy task. This time the data contains longs so I can't use standard SQL. The data in the long is too long for a PL/SQL long datatype so that's not worked.
    I've tried the COPY FROM command but get the invalid sql command error.
    Can anyone save my hair?

    The COPY command doesn't have to be all on one line. The continuation character for SQL*Plus commands is a hyphen.
    SQL> prompt "Hello"
    "Hello"
    SQL> prompt -
    "Hello""Hello"
    SQL>Metalink is the website for customers that pay for Oracle support. Go to www.oracle.com and click on the metalink button on the top left of the screen. It's called Metalink because Oracle support levels are named after metals: bronze, silver, gold.

  • Sql syntax for converting a long datatype value in to a integer datatype value

    I have to make a sql query where in i have a value of long datatype and i want to convert it into integer datatype value
    null

    It would have helped if you could have posted sample data.
    now my requirement is to calculate the difference in hours between the start time and end time.Assuming you want the difference in time irrespective of the dates and the time is stored like HH24:MI:SS format, you could try something like:
    SQL> WITH test_tab AS
      2       (SELECT '09:12:33' start_time, '12:30:33' end_time
      3          FROM DUAL
      4        UNION ALL
      5        SELECT '09:12:33' start_time, '14:12:33' end_time
      6          FROM DUAL)
      7        -- end of test data
      8  SELECT end_time, start_time,
      9         TRUNC (  (  TO_DATE (end_time, 'HH24:MI:SS')
    10                   - TO_DATE (start_time, 'HH24:MI:SS')
    11                  )
    12                * 24
    13               ) diff_in_hours
    14    FROM test_tab
    15  /
    END_TIME START_TI DIFF_IN_HOURS
    12:30:33 09:12:33             3
    14:12:33 09:12:33             5
    2 rows selected.Hope this helps,
    Regards,
    Jo

  • SQL Plus / Oracle - Username and Password Troubles

    Hello all
    I have just download Oracle Database 10g Express Edition for Linux.
    When i use the command 'connect' with SQL Plus i am required to enter a username ans password.
    What is the default username and password, or where can i find it?
    Many thanks

    1. If you installed the express edition, there is another step. Go to your GUI menu->Oracle->Documentation. Those names are not exactly right, but you should be able to figure them out from that
    2. You are missing a post install step which the install documentation will tell you from step 1. If it is a regular Linux, you drop to a terminal and type something like "database configure". Look at the install documentation, it will tell you.
    3. Do you have Apache running? You need a web server for the Oracle web interface to work
    4. The error message you got means exactly what it says. That being said, you can also get this error message when the database is running. If you do, it is because you forgot to include a connection on you command:
    connect sys/manager@xe
    OR
    connect sys/manager@localhost:1521Since you don't know the passwords, I assumed you did not run the configure step above since it asks for the password when you run it.
    Loyal

Maybe you are looking for