74H1R
74H1R

Reputation: 3514

How to execute insert SQL through .bat file in Oracle?

I am doing a simple insert through .bat file. But It's not executing the second statement.

sqlplus scott/tiger


insert into dept values (60, 'Support', 'Redwood');

How can I run the second statement? I must be missing something.

Upvotes: 2

Views: 3281

Answers (2)

dbaOnTap
dbaOnTap

Reputation: 186

To get it all to work from the .bat file, you need something like this:

@echo insert into dept values (60, 'Support', 'Redwood'); | sqlplus scott/tiger

Upvotes: 1

S.P.
S.P.

Reputation: 3054

Assuming your columns are correct for insertion Here is what I would do.

sqlplus scott/tiger @c:\yourSqlScript.sql
exit

Then in your "yourSqlScript.sql", you have

insert into dept values (60, 'Support', 'Redwood');
exit

Upvotes: 2

Related Questions