how do you write sql queries using shell script
for eg:- we have databae table like EMPNO,ENAME,SAL,DEPTNO
columns in EMP table how you display EMPNO,SAL FIELDS from emp
in SHELL SCRIPT please explain with an example

Answer Posted / alpkumar

Do you mean something like this .. how do you use queries
in conjunction with shell scripts..If so, usually the
general practice which goes on is that -- write a query on
what ever database you are working with with the relevant
sql syntax.. call this query from the shell script.
For this, in our program we should start using the commands
that the database company will be providing to use in unix
environement.. So use these unix commands for connecting to
the database, calling the specific query which we had
created..,.etc ...So look out for the commands which will
be available from database provider..to use in unix/linux
flavours and accomplish your script to perform the action
automating in generating reports and mailing them (or what
ever you wanna do.. )

Is This Answer Correct ?    6 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is awk script?

716


how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?

3830


What are the disadvantages of shell scripting?

839


What are the different types of variables used in shell script?

746


What is difference between shell and bash scripting?

719


How to get the 3rd element/column from each line from a file?

934


What is bash shell command?

721


How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?

896


How do I edit a .sh file?

851


How to print the first array element?

778


How to pass an argument to a script?

777


What is shell prompt?

731


What is the first line in a shell script?

774


How can you get the value of pi till a 100 decimal places?

743


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

822