Solved

INSERT into Oracle Database multiple text lines not from another DB

Posted on 2012-03-15
4
494 Views
Last Modified: 2012-03-15
have a DB with only one field (LINELN  - varch2 (100)) ... I would like to do a mass insert.
(I'm new to Oracle.  I'm using TOAD)

Example:

insert into my_database VALUES(' 03/01/2012  15:51');   -- works to insert one row.

I want to insert multiple rows (copied from a PDF file and format with required parameters at the beginning and end of each line.  then insert all)

insert into my_database VALUES(' 03/01/2012  15:51');
insert into my_database VALUES('line one of test data');
insert into my_database VALUES('line two of test data');    ---etc

Thanks!!!
0
Comment
Question by:lynn_harris
  • 2
  • 2
4 Comments
 
LVL 2

Expert Comment

by:costaf
ID: 37725313
my advice is to use an excel workbook to build an sql insert script. define the main sql statement to run, then copy paste down the number of lines you need and modify the variables you need.
then , you might need to open the resulting sql designed in excel in a notepad ++ to remove the spaces that excel puts when you copy paste the lines , simply by find +replace and voila.
run the inserts statements in a pl/sql or toad and commit.

see the image attached
excel-sql-insert-build.PNG
notepad-replace-spaces.PNG
0
 

Author Comment

by:lynn_harris
ID: 37725657
Thank you... attachments were very helpful.  I was basically doing the same thing and coming up with a number of formatted lines like yourself.  

So ... maybe it is the way i'm executing it.  I cut and pasted all lines into TOAD editor and select execute.   However, it will only process the line my cursor is on.  (not mass insert all lines.)  

toad screen attached.


Thanks for you help!!
insert-doc.docx
0
 
LVL 2

Accepted Solution

by:
costaf earned 500 total points
ID: 37725664
for that you have to execute as script . use the icon with a sheet and a lightning bolt at the right of the normal excecute (green play) button.
0
 

Author Closing Comment

by:lynn_harris
ID: 37725694
Thank you!!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
use lov values 2 71
Oracle encryption 12 59
Field name with special character (Ñ) in Oracle 11 130
make null the repeated levels 2 36
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question