connect an oracle db , retrieve some data from a database table via a bat file (w7)

Hello,
I am really new in writing bat/ sql files and I need some help.
I need to connect an oracle db to retrieve some data from a database table via bat file  
Could you tell me how to do it?

Thank you.
Diana_BAsked:
Who is Participating?

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

x
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.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
If you can choose,  you should use PowerShell instead of a cmd batch file. With a traditional batch file you need to run sqlplus with formatting settings in sqlplus, then parse the resulting text. With PowerShell you can run commands against Oracle via ADO.NET, and directly access results, doing whatever you want to do with it.
Geert GOracle dbaCommented:
why would you use powershell or the command line

get a programming tool, create an exe and use that exe
there is even some programming environments free
like perl

since you need to start from scratch anyway ... take the more advanced step immediately
Geert GOracle dbaCommented:
but, if you really want to do it from the command line

download and install oracle client, the runtime version
from oracle.com downloads ... it's free

sqlplus user/password@database @yourscript.sql

Open in new window

in yourscript.sql:
spool outputfile.txt
select yourquery;
spool off

Open in new window

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
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!

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Of course the code Geert posted is too primitive to really be useful in a batch, but it shows some of the basics

Geert, never question the use of PowerShell :D.
It is a semi-interpretative programming language, generating P-Code as any other .NET language does too. But it is much more flexible when having to apply changes. Nevertheless, using a custom EXE is an option if there are no changes, and always the same process to be run.
Geert GOracle dbaCommented:
a custom EXE is also an option if there are changes ... :)
Steve WalesSenior Database AdministratorCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Geert Gruwez (https:#a40960495)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

sjwales
Experts-Exchange Cleanup Volunteer
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
Windows Batch

From novice to tech pro — start learning today.