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
Which shell is the best?
What happens when you type ls?
How to get the first line from a file using just the terminal?
Is shell script a programming language?
what is tickets $ what low,medium,high priorite pls define time also
What is a boot block?
What is awk script?
What does .sh file contain?
how will you find the total disk space used by a specific user?
What is bash command used for?
Where are cowrie shells found?
What is computer cli?
How do I open the shell prompt?
What language is bash?
What does $@ mean in shell?