This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 31st, when you will be able to use this site as normal.

    Forum Stats

  • 3,890,791 Users
  • 2,269,776 Discussions
  • 7,916,827 Comments

Discussions

Sql Loader instead of Insert ?

470436
470436 Member Posts: 250
edited Apr 8, 2014 3:58AM in SQL & PL/SQL

Hi all,

I have a Insert into Table1 Select * from table2 in one of our procedures.

I am at this point aware that sql loader is used to insert into tables , data from external sources  . Can I get this done using Sql loader completely replacing the above mentioned Insert/select.

If this is possible how I can go about it ?

Kindly guide me in this regard

with warm regards

ssr

Tagged:

Answers

  • Manik
    Manik Technical Specialist SingaporeMember Posts: 2,908 Gold Trophy

    Whats your version of oracle...?

    Cheers,

    Manik.

  • Nimish Garg
    Nimish Garg Sr. Database Developer @ Gartner Noida, IndiaMember Posts: 3,185 Gold Trophy

    Not sure about SQL Loader,

    Insert into Table1 Select * from table2 is a very good option. use it with APPEND hint if you are facing some performance issues.

  • 470436
    470436 Member Posts: 250

    hi manik

    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production

  • 470436
    470436 Member Posts: 250

    thanks Nimish

    I will give a try to it ....

  • Manik
    Manik Technical Specialist SingaporeMember Posts: 2,908 Gold Trophy

    Yes agreed.. if we know the oracle version we can suggest using external table.. that is why I was curious to ask the version of oracle. That would be something similar to "insert into table select * from externaltable  (which is direct replication of file)"

    Cheers,

    Manik.

  • Manik
    Manik Technical Specialist SingaporeMember Posts: 2,908 Gold Trophy

    Use Oracle external table directly and then you can use insert into <yourtable> select * from externaltable   --  external table is direct representation of your file.

    Read manual about that.

    External Tables Concepts

    Cheers,

    Manik.

  • 470436
    470436 Member Posts: 250

    Dear Manik ,

    Thanks for your suggestion and the link

    the task which I mentioned

         Insert into Table1 Select * from table2

    Both the tables Table1 to which records are inserted and Table2 from where records are selected are in the Oracle Database. We could have several tables from where the records are selected and inserted into Table1. Since  this insert operation has been taking a long time . there was a suggestion that Sql loader can be used since It is more efficient than Insert . as I mentioned that I understand that sql loader  is used for inserting data from external source. I was confused how sql loader can be used to select data from a table residing in oracle database and insert it into another table in the db.. The External Table enables us  to access data in external external  as if it were in a table in the database.

    My predicament is can we use sql loader or External table instead of the Insert into   Select from ...

    With Warm Regards

    ssr

  • Manik
    Manik Technical Specialist SingaporeMember Posts: 2,908 Gold Trophy

    Oh your question was ambigous to me.. If you have both tables on Oracle database, then go for

    insert /*+ append*/ into <destination_table> select * from <source_table>

    Cheers,

    Manik.

  • Muhammad Yousuf Khosa
    Muhammad Yousuf Khosa Oracle Database Administrator Karachi, PakistanMember Posts: 12
    edited Apr 8, 2014 3:58AM

    Hey!!! SSR

    if ur table2 is in ur database then its not possible to use sql Loader, coz sql loader tool is purely used to insert data into database from external tables which are not present/available in our oracle database which has different file format.

    Insert into Table1 Select * from table2  would be ok for this,

    or if u want to move the same data with the same structure into another database then u may use Datapump  Imp/Exp

    Regards,

    Yousuf Khosa

This discussion has been closed.