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 we delete all blank lines in a file?
What is the difference between grep and egrep?
Is scripting and coding the same thing?
How do I run a .sh file?
Explain about "s" permission bit in a file?
Is powershell a bash?
How do I open the shell prompt?
What are the different variables present in linux shell?
What is subshell?
Why should we use shell scripts?
What is inside a seashell?
Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.
How do I read a .sh file?
What are zombie processes?
What is the way to do multilevel if-else's in shell scripting?