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
State the advantages of shell scripting?
What are the advantages of shell scripting?
What is shell application?
What is a shell script in windows?
Write down the syntax of "for " loop
What command needs to be used to take the backup?
Explain about the slow execution speed of shells?
How to calculate the number of passed arguments?
What are the different variables present in linux shell?
What is a shell made of?
What is awk script?
Explain about the exit command?
determine the output of the following command: echo ${new:-variable}
What is scripting autism?
What is the way to do multilevel if-else's in shell scripting?