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.

Similar Messages

  • SQLPLUS COPY COMMAND and TIMESTAMPS

    I am copying data from production to a database warehouse. We had used insert into at one point but switched to the SQLPLUS COPY command as it increased our performance by almost over 50%. We recently added a table that has a TIMESTAMP. I understand this datatype isnt supported by COPY. Is there anything that I can use other than going back to the INSERT statement through a DB link?
    Thanks,
    Scott

    Hi,
    Just refer to Data Pump
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_overview.htm#sthref22

  • Problem with sqlplus copy command

    When I try to use the SQLPlus Copy command (with Append or Insert action) with a 8.1.7 source DB and a 9.2.0.4 destination DB, I receive the "CPY0006: Select list has more columns than destination table" error.
    The tables are identical in both DBs so I am confused.
    Just to make sure the tables were identical, I then used the Copy command with the Create option and used a new table name.
    That worked, however if I then try to use the Copy with an Insert or Append action against the table I just created, I get the error again.
    I am using SQLPlus 8.1.6.0.0
    Output from SQL*Plus:
    NTEG> SET COPYCOMMIT 40;
    NTEG> SET ARRAYSIZE 1000;
    NTEG> COPY FROM xxxxx/xxxxx@nteg -
    TO xxxxx/xxxxx@DEV -
    INSERT sysadm.PS_ANIMAL_TBL -
    USING select * FROM sysadm.PS_ANIMAL_TBLArray fetch/bind size is 1000. (arraysize is 1000)
    Will commit after every 40 array binds. (copycommit is 40)
    Maximum long size is 80. (long is 80)
    CPY0006: Select list has more columns than destination table
    Descr from both DBs
    NTEG> descr ps_animal_tbl
    Name
    ANIMAL_CD
    DESCR50
    DESCRSHORT
    DEV> descr ps_animal_tbl;
    Name
    ANIMAL_CD
    DESCR50
    DESCRSHORT

    SQL> help copy
    COPY
    COPY copies data from a query to a table in a local or remote
    database.
    COPY {FROM database | TO database | FROM database TO database}
    APPEND destination_table
    [(column, column, column, ...)] USING query
    where database has the following syntax:
    username[password]@connect_identifier
    SQL>
    Joel P�rez

  • 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);

  • Sqlplus copy command

    Am trying to use copy command (copy data from table in old db to table in new db); am coming up with ERROR:
    ORA--3929306: Message -3929306 not found; product=RDBMS; facility=ORA and I cannot find any information on this error. The search function in this forum wasn't working either...

    can you tell the syntax you are using ?

  • Query Program ! use this for your query's like SQLPlus , copy-paste and run

    H!
    Like the Subject Title:
    If you have PHP and Oracle then you can use this if you are learning the query's or you don't wanna use SQLPlus.
    BTW this is my first script, but it works fine here.
    //the code
    <?//made by [email protected]
    IF($_SERVER['REQUEST_METHOD'] == 'POST' AND isset($_POST['username']) AND isset($_POST['password'])) {
    //gebruik het juiste dll bestand.
    dl("php_oci8.dll");
    define("USERNAME",$username);
    define("PASSWORD",$password);
    $conn      = OCILogon(USERNAME,PASSWORD);
    $sql      = stripslashes($sql);
    IF($btnRollback){
         ocirollback($conn);
         echo "Rollback done !";
    IF($btnCommit){
    ocicommit($conn);
    echo "Committed !";
    IF($btnVersion){
         echo OCIServerVersion($conn);
    IF($btnSql){
    $stmt      = OCIParse($conn,$sql);
    IF(OCIExecute($stmt) === TRUE){
              $msg = "The Query was oke !";
    if (OCIStatementType($stmt) == "SELECT") {
         $ncols     = OCINumCols($stmt);
         echo "<table width=\"100%\" border=\"1\" cellspacing=\"1\" cellpadding=\"0\" bordercolor=\"#FFFFFF\" bordercolorlight=\"#FFFFFF\" bordercolordark=\"#FFFFFF\">\n";
         echo "<tr>\n";
         for($i=1;$i<=$ncols;$i++){
         $column_name[$i] = OCIColumnName($stmt,$i);     //tabel kopjes
              $column_type[$i] = OCIColumnType($stmt,$i);     //extra info
    $column_size[$i] = OCIColumnSize($stmt,$i);      //extra info
              echo "<td class=\"row\"><b>$column_name[$i]</b></td>\n";
         echo "</tr>\n";
         while(OCIFetch($stmt)){
         echo "<tr>\n";
              for($i=1;$i<=$ncols;$i++){
         $column_value[$i] = OCIResult($stmt,$i);
                   echo "<td class=\"row\">$column_value[$i]</td>\n";               
         echo "</tr>\n";
         //extra info
         echo "<tr>\n";
         for($i=1;$i<=$ncols;$i++){
              echo "<td class=\"row\"><i>$column_type[$i] $column_size[$i]</i></td>\n";
         echo "</tr>\n";
         echo "</table>\n";
         OCIFreeStatement($stmt);
    OCILogoff($conn);
    ?>
    <style type="text/css">
    <!--
    .row { 
         background-color: #EEEEEE;
         border: #000000;
         border-style: solid;
         border-top-width: 1px;
         border-right-width: 1px;
         border-bottom-width: 1px;
         border-left-width: 1px;
         font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt;
    -->
    </style>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="submit">
    <hr>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="37%">
    <textarea name="sql" cols="60" rows="10"><?echo $sql;?></textarea>
    </td>
    <td width="63%" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="12%">Username:</td>
    <td width="88%">
    <input type="text" name="username" value="<?echo $username;?>">
    </td>
    </tr>
    <tr>
    <td width="12%">Password:</td>
    <td width="88%">
    <input type="password" name="password" value="<?echo $password;?>">
    </td>
    </tr>
    <tr>
    <td width="12%"> </td>
    <td width="88%"> </td>
    </tr>
    <tr>
    <td width="12%">
    <input type="submit" name="btnSql" value="Sql">
    </td>
    <td width="88%">
    <input type="submit" name="btnCommit" value="Commit">
    <input type="submit" name="btnRollback" value="Rollback">
    <input type="submit" name="btnVersion" value="Version">
    </td>
    </tr>
    </table>
    <?echo $msg;?> </td>
    </tr>
    </table>
    <br>
    <font face="Verdana, Arial, Helvetica, sans-serif" size="1">don't use ;</font>
    </form>

    But your script is not outputing the result of the query. So how do we view the returned resultset.

  • SQLPlus COPY error: ORA-03114: not connected to ORACLE

    This is what I'm trying to do:
    I'm logged into an Oracle 8.1.6 database on a Windows 2000 Professional box and trying to copy data and tables from an Oracle 7.3.4 database on an HP/UX box.
    I log into my 8.1.6 SQLPlus as:
    scott/tiger@testdb
    Then I run the following:
    SQL> set copycommit 1
    SQL> set arraysize 1000
    SQL> copy from user/user1@devp1 -
    create reps_t -
    using -
    select * from reps_tThis is my error:
    ORA-03114: not connected to ORACLE
    Can someone give me a better understand how SQLPlus COPY works and give me an idea how to locate the problems.
    Thanks,
    Laith E.H.
    null

    I think this combination user/user1@devp1
    is not ok.
    U can get good material about copy command
    from technet itself. Just search for Copy

  • Save A Copy Command

    I've got an indesign files which is over 200MB, I used the "save a copy" command and the file size has reduced to 70MB, can anyone tell me why that happens? Thanking you!

    > which you could have used Undo to step backwards with...
    Not part of the file.
    Saving a 200 MB or larger file, especially over a network, can take a while and force you to pause, maybe up to a minute, when saving. Not only is that annoying, it's a disincentive to sae, which can be much worse than annoying. So InDesign saves your changes to the file, which are usually a very small amount of data relative to the file size. Save As when you're done with the file to get he size down.

  • Copy command in Sqlplus

    I am using 8.1.6 and 8.1.7, but the copy command does not seem to work on either cases, the sqlplus just crash, did you guys have the similar problem? Is it a bug in oracle or there is some parameter I need to set up correctly?
    Your help is highly appreciated.

    it works i tried
    null

  • Copy command of SQLPLUS is failing

    Oracle Version 8i.
    When trying to use the copy command -in SQLPLUS- to copy the data from one database to the other, I am encountering the following error.
    Error: SP2-0027: Input is too long (> 2499 characters) - line ignored
    Reason for using the copy command is: Allows me to set commit points as against Insert into ... select * from command.
    The table, I am copying has lot of columns and the number of characters in the script are more than 3000.
    Where is the restriction of 2499 characters set? Is there a way to alter this?
    Thanks
    null

    You can export the table(s) and import into your database.

  • [svn:bz-trunk] 21277: Added ds-console source to package-oem and removed copy command for datavisualization .swc which doesn't exist in the specified location.

    Revision: 21277
    Revision: 21277
    Author:   [email protected]
    Date:     2011-05-18 11:35:28 -0700 (Wed, 18 May 2011)
    Log Message:
    Added ds-console source to package-oem and removed copy command for datavisualization.swc which doesn't exist in the specified location. I do not find it in the most recent package-oem.zip neither
    Modified Paths:
        blazeds/trunk/build.xml

    Gusar wrote:No, it's not. I have actually seen cases where software rendering gave a higher glxgears score than hardware rendering (and no, it wasn't about vsync). Of course, with *actual* apps on the same machine, software rendering sucked compared to hardware rendering.
    Please do not jump to conclusions and make assumptions here like 'when will people finally get it??'.  I never said it was a benchmark.  I have also seen many examples of where it's results do not go with conventional performance.  I have a Radeon 9000 that goes faster on glxgears than a Geforce FX 5600 running Nouveau.  Which is the faster card?  The FX by miles.  It is not a benchmark as it can not be compared between configurations.  What I know is that on this individual system, from prior experience over many years when 3D acceleration is working glxgears gets between 300 and 400 fps.  When it is not working it gets less than 10.  That is a fact but does not mean it is benchmarkable.  Yes, a Quake 3 timedemo (I have these numbers too and they very much correlate to glxgears performance for this system given just how slow it is) would be a benchmark but when it runs less than 0.1fps and even the 2D rendering means that navigating the menu is impossible, there just isn't the time to find out.  Hence if playing around with drivers on this system I would use glxgears to check that 3D acceleration is working but not to benchmark.  Glxinfo does not give you all this evidence.
    But to clarify, I wouldn't use glxgears as a benchmark, benchmarking is different and I do a lot of that too.

  • How to using sqlplus to connect and run command ?

    Hello,i have a small problem please help me
    I want to use sqlplus to connect and run command
    for example : sqlplus test/test@DB select sysdate from dual ;
    and then it will show data (sysdate) to screen
    what should i do ?
    Thanks

    kenshin19xx wrote:
    Hello,i have a small problem please help me
    I want to use sqlplus to connect and run command
    for example : sqlplus test/test@DB select sysdate from dual ;
    and then it will show data (sysdate) to screen
    what should i do ?
    Thanks
    bcm@bcm-laptop:~$ echo "select sysdate from dual ;" > now.sql
    bcm@bcm-laptop:~$ sqlplus user1/user1 @now
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 14 20:41:33 2011
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SYSDATE
    2011-12-14 20:41:33

  • Datatype problem while using copy command

    Hi all,
    I an using copy command to copy data
    SQL> copy from xyz/abc@xxx to aaa/sss@aaa create Table1(Name,duration) using select * from Table2The problme is in Table2 duration is like 4.5,but when after copying in Table1 it is coming as 4 .
    Could someone help me in fixing this ?
    rgds,
    Karna

    try not defining the columns first, the create will do that.
    copy from xyz/abc@xxx to aaa/sss@aaa create Table1 using select * from Table2
    I am assuming the table2 only contains the two columns.

  • COPY command not working SQL Commands editor

    Hi All,
    I want to have a simple 'one-button-solution' for copying few tables from an external DB into the database where my Apex application is running.
    When I issue the following from the sqlplus command line I get the following output:
    SQL> COPY FROM schema/password@tnsnames_sid TO schema/password@tnsnames_sid REPLACE TABLE_TEST USING select * from TABLE_FOREIGN;
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    Table TABLE_TEST dropped.
    Table TABLE_TEST created.
    2 rows selected from schema@tnsnames_sid.
    2 rows inserted into TABLE_TEST.
    2 rows committed into TABLE_TEST at schema@tnsnames_sid.
    SQL>
    However, if I try exactly the same command from within the Apex 'SQL Commands' editor, I get the following error message:
    ORA-00900: invalid SQL statement
    NOTE that the reason I use COPY command is to overcome problems with LONG datatype which arise when doing simply CREATE TABLE AS.... with dblink.
    In anycase, how can I make this work from within the 'SQL Commands' editor (and therefore in a button process).
    Regards,
    Pawel.

    Hi Harman,
    yes, this is a known issue.
    It's fixed with NW04 SPS 13.
    Regards Matthias Röbig-Landau

  • How to configure host copy command inside EM Console

    hi,
    I want to copy a file from one server to my production server. i found that through host copy command its is possiable in command prompt.but when i configure host copy command inside em console it is not working. i am getting following error
    ORA-06550: line ORA-06550: line 3, column 6: PLS-00103: Encountered the symbol "COPY" when expecting one of the following: := . ( @ % ; , column :
    Any solution for this
    Edited by: mithun on Jun 16, 2011 2:36 AM

    mithun wrote:
    hi,
    I want to copy a file from one server to my production server. i found that through host copy command its is possiable in command prompt.but when i configure host copy command inside em console it is not working. i am getting following error
    ORA-06550: line ORA-06550: line 3, column 6: PLS-00103: Encountered the symbol "COPY" when expecting one of the following: := . ( @ % ; , column :
    Any solution for this
    Edited by: mithun on Jun 16, 2011 2:36 AMThis makes no sense whatsoever.
    Now, as for your original question, there is not "host copy" command. Not in sqlpus, not in em.
    What you are doing in sqlplus is the sqlplus command "host". That is a sqlplus command, documented in the SQLPlus Reference. The sqlplus command "host" takes an argument of an os command (in your case, the OS command is "copy") and creates a sub-process to ask the os to execute that command.
    I can't even imagine what you are referring to when you say "when i configure host copy command inside em console". Can you explain in more detail?

Maybe you are looking for

  • Why does Server Monitor not work with non-Xserves?

    Does anyone know why Server Monitor does not work with non-Xserve computers? We acquired a Power Mac for a server, based on there being no apparent difference except for the obvious. Turns out there are some differences after all. Do Power Macs lack

  • Database connection is not working in Free Acrobat Reader

    Hi, I am working on a pdf that imports data from an sql server. I got it working flawlessly in livecycle and in Acrobat Reader Pro. But in Free acrobat reader it makes an index error on the click event on the button that runs the javascript for getti

  • Safari Crashes and then will not open yahoo.mail or gmail

    Safari Crashes and then will not open yahoo.mail or gmaill Is anyone else having these, or similar problems. i cannot log-in to my yahoo.com or onto gmail. The issue started yesterday. The message states that it cannot secure the connection. Any sugg

  • CS6 Failed to open document.

    This has happened more than once. File gets saved and published successfully. The next time I attempt to open the document, I get the error message. Revisions to document are usually only text (not with standard web fonts such as Arial, Verdana, etc.

  • IPhoto 09 Picture size

    The photo size slider looks as if it won't move all the way to the right, and even if I click on the icon (for largest size), my photos still are not as large as they were in 08. I get 4 photos across whereas I used to be able to get a single photo i