Link to home
Start Free TrialLog in
Avatar of Lynn Harris
Lynn HarrisFlag for United States of America

asked on

INSERT into Oracle Database multiple text lines not from another DB

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!!!
Avatar of costaf
costaf
Flag of Portugal image

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
Avatar of Lynn Harris

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of costaf
costaf
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you!!!!