Results 1 to 5 of 5

Thread: Insert Script

  1. #1
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Insert Script

    I have to send a table data as insert script to another person. How to create insert script for table data in SQL * PLUS?


  2. #2
    Junior Member
    Join Date
    Nov 2007
    Answers
    22

    Re: Insert Script

    Quote Originally Posted by krishnaindia2007 View Post
    I have to send a table data as insert script to another person. How to create insert script for table data in SQL * PLUS?
    ya you can send it by simply write the query in the text editor, in the text editor first crete a table if table is not exist and written a insert queries to it when he will run that script it is created a table and after that script will insert the data in it.

    pls do it so that you will be clear ....

    thanks and regards


  3. #3
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: Insert Script

    In toad we can simply create it by right clicking on the grid and if we select create insert for all rows it will automatically create insert script.
    In SQL *Plus if there are 20,000 records do I need to write insert command 20000 times in text editor to create script? Is there any other way to create the script using direct command or procedure?


  4. #4
    Junior Member
    Join Date
    Apr 2006
    Answers
    2

    Re: Insert Script

    I dont know if we could create multiple insert statements like in TOAD, But you can try spooling the data to be inserted into a text file and then use BULK_INSERT to insert data from that file into the table.

    Example for BULK_INSERT is given below:

    BULK INSERT SalesOrderDetail
    FROM 'f:\orders\lineitem.txt'
    WITH
    (
    FIELDTERMINATOR ='|',
    ROWTERMINATOR ='\n'
    )

    where SalesOrderDetail = table name, 'f:\orders\lineitem.txt' = file from which the data is to be inserted.


  5. #5
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: Insert Script

    Try this
    Sql > set heading off
    Sql > select 'insert into emp values('||empno||','||ename||''||job||','||sal||','||comm||','||deptno||','||mgr||','||hiredate||');' from emp;
    Sql > Spool insert_s.sql;
    Sql > /
    Sql > Spool off;
    Using this u can find insert script of emp .To run the script use the below statement
    Sql >@ insert_s.sql;


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact