Multiple SQL Statements in a sql script [message #9568] |
Wed, 19 November 2003 13:54 |
Just Me
Messages: 10 Registered: November 2000
|
Junior Member |
|
|
Hi,
I am using Oracle 9i.
Is there a way to write more than one sql statements in one sql script and run them all at once? example,
Insert Into table1 values (1, 2, 3)
Insert Into table2 values (10, 20, 30)
To do these two actions, I have to select each statement and then run it. I have 50 such statements!
Thanks
|
|
|
Re: Multiple SQL Statements in a sql script [message #9569 is a reply to message #9568] |
Wed, 19 November 2003 14:10 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
Put all the statements in a file, say, script.sql, and make sure to put a semicolon at the end of each statement.
Insert Into table1 values (1, 2, 3);
Insert Into table2 values (10, 20, 30);
Then, in SQL*Plus, to run the script:
|
|
|
Re: Multiple SQL Statements in a sql script [message #9574 is a reply to message #9568] |
Wed, 19 November 2003 21:43 |
PPMD
Messages: 1 Registered: November 2003
|
Junior Member |
|
|
Make 2 seperate sql scripts for 2 data files
that script will have
abc.sql
insert into table_name values ('&&1','&&2','&&3')
abc_1.sql
take the datafile /text file the contains data &for that append in the beginning as below
for ex: if ur data file isas below
data file
00 12 11
@abc.sql 00 12 11
means to ur datafile, u add thescript name so that, that will get executes no of time as thedata.
Hope this is clear...
try it out
good luck...
|
|
|
|
|