Batch script to run sql script

I have a batch program which creates a sql file (ORACLE)which invokes other sql files

for example the generated sql file by batch script "Generatedfile.sql"

spool to <somelogdir/logfile.log>
prompt execute abc.sql
@ <\path\to\abc.sql\>abc.sql

prompt execute XYZ.sql
@ <\path\ to\ XYZ.sql\>XYZ.sql

etc etc..

spool off

I am invoking the sql file using

sqlplus -S <someUsername>/password@hostname:1521/Some_SID

Sql file just sits and spins without doing anything

I have tried running from command prompt and invoking from other programs, it just sits and spins. Log file generated is empty.  and I don't get an error

Any ideas?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Amit KumarCommented:
set ORACLE_SID=orcl
c:\oracle\ora81\bin\sqlplus system/manager @c:\first.sql

Copy your Oracle code in first.sql file.
slightwv (䄆 Netminder) Commented:
>>I am invoking the sql file using sqlplus -S <someUsername>/password@hostname:1521/Some_SID

I don't see where you actually provided the script to execute?

sqlplus -S <someUsername>/password@hostname:1521/Some_SID @Generatedfile.sql
slightwv (䄆 Netminder) Commented:
The -S is 'silent' in sqlpus so you don't see the SQL> prompt but that is where it is sitting.

At the blinking prompt, type a command:
show user
select sysdate from dual;

It will respond.

Nice Google...  but they already have a script that has all the commands.  It is called Generatedfile.sql.

However, that copy/paste from another site does have the answer.  It is what I provided.  The script name.

If you are going to copy from another site, you need to provide the link where it came from:
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Amit KumarCommented:
I dont think so I need to copy link of reference.. as I got message from Expert Exchange admins that provide relavent information no need to paste links all the time.
maverickxxAuthor Commented:

I don't think I understand . I am trying to execute the batch script  from Continuous integration server(Jenkins).  How do I  make it respond without user interaction?
slightwv (䄆 Netminder) Commented:
>>I don't think I understand .

You execute sqlplus but you don't tell sqlplus to execute the file with all the sql commands: Generatedfile.sql

You need to provide the @Generatedfile.sql at the end of the command line when calling sqlplus.

>>I dont think so I need to copy link of reference..

I see you are new here.  Welcome.

The message you received likely told you that you should not post Blind Links.  Where you just Google an answer and post something like:
Look here:
<some link from Google>

They should have also covered  Plagiarism.

Please review:

If you use content from another site, make sure you include the correct citations, references, and attributions. Usually this is as simple as a link to the site where the content originally appeared.

Always make it clear when you are quoting someone else. Plagiarism is taken very seriously at Experts Exchange, and will not be tolerated.

Links can support the answer you post but what you post needs to be your own answer.

I understand that you just want to help others.  For questions where you don't know the answer to the question, you should probably let other Experts handle it.
maverickxxAuthor Commented:
@slightwv ,

I did do this earlier, I just missed it in my question.

sqlplus -S <someUsername>/password@hostname:1521/Some_SID @Generatedfile.sql

It is still spinning
slightwv (䄆 Netminder) Commented:
>>It is still spinning

Did you type something like I mentioned above?

In the window that is 'spinning', type:
select sysdate from dual;

If the date shows up, you are really sitting at the sqlplus prompt and the '-S' is hiding it.

If I run sqplplus -s user/password I get a 'hung' window as well until I type something...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DavidSenior Oracle Database AdministratorCommented:
Get rid of the silent setting until you have the code working -- deconstruct the complexity then layer it back on.
Mark GeerlingsDatabase AdministratorCommented:
You definitely need to included the " @GeneratedFile.sql" syntax at the end of your sqlplus command.  And, you may also need to make sure that this line gets added as the last line in your "GeneratedFile.sql":

That is an excellent suggestion from dvz: get all parts of this working without the "-S" while you test, then add that back in when you are ready for this to be used in production.
maverickxxAuthor Commented:
thanks  for solution,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.