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
c program the catches the ctrl-c(SIGINT) Signal for the first time and prints a output rather and exit on pressing Ctrl-C again
What's the difference between scripting and coding?
How can I send a mail with a compressed file as an attachment?
What is the use of .sh file?
What are the different communication commands available in the shell?
How do I run a powershell script?
Why is shell scripting important?
What is awk in shell script?
What is awk script?
Explain about non-login shell files?
Is bash a shell script?
c program to display the information of given file similar to givan by the unix or linux command ls -l
What is difference between shell and bash scripting?
What is bash coding?
How will you find the 99th line of a file using only tail and head command?