Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / krishna

create a variable for your query like

sql1='select empid,empname,.... from emp;' in your script

then call sqlplus in your shell script as

slplus user/password@sql1

you can redirect the output or format it as you like.

you can pass userid pwd as parameters as arguments to your
shell script and use them as parameters $1 and $2. you can
check if all the parameters are given with Usage [$# eq. 2 ]
etc.

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

State the advantages of shell scripting?

1052


What are the advantages of shell scripting?

1042


What is shell application?

990


What is a shell script in windows?

1089


Write down the syntax of "for " loop

1099


What command needs to be used to take the backup?

988


Explain about the slow execution speed of shells?

1229


How to calculate the number of passed arguments?

1098


What are the different variables present in linux shell?

1106


What is a shell made of?

962


What is awk script?

980


Explain about the exit command?

986


determine the output of the following command: echo ${new:-variable}

982


What is scripting autism?

1215


What is the way to do multilevel if-else's in shell scripting?

1301