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
How do I run a .sh file on mac?
What is the best shell scripting language?
How to open a read-only file in the shell?
What is the default ubuntu terminal?
What language is bash written in?
Is shell and terminal the same?
Explain about return code?
Why should we use shell scripts?
What does the sh command do?
How to get the first line from a file using just the terminal?
When should shell programming/scripting not be used?
How does shell scripting work?
how will you find the total disk space used by a specific user?
What is bash command used for?
What is a shell? · Types of shell · what is shell scripting?