Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

INSERT into Oracle Database multiple text lines not from another DB

Posted on 2012-03-15
4
Medium Priority
?
502 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

885 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