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
determine the output of the following command: echo ${new:-variable}
What is basename in shell script?
Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.
Explain about non-login shell files?
What is the difference between break and continue commands?
What is the default ubuntu terminal?
Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.
Why do we write bin bash in shell scripts?
What does $$ mean in shell script?
write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?
What is an sh file?
Which shell is the best?
What are the advantages of shell scripting?
Explain how you Automate your application using Shell scripting.
What is the syntax of "nested if statement" in shell scripting?