1.11M Members

oracle and shell scripting

 
0
 

needed help how can i connect to my oracle database using shell script and how can i assign particular value in table to a variable defined in shellscript and i use sqlplus but i get error

 
0
 

show what you've done.

all our cristal balls are broken ;)

 
0
 

hi
i use the following code but i get this error
./cv.txt: line 17: unexpected EOF while looking for matching ``'
./cv.txt: line 29: syntax error: unexpected end of file
the file is too big so i write just the part to connect to database

ORACLE_VALUE=`sqlplus -s scott/ZooM1990 << EOFSQL
set head off
select * from emp where empno=7369;
EOFSQL'
echo $ORACLE_VALUE

i also use another code but i get this error
line 18: syntax error near unexpected token from' ./test: line 18:select * from dual'
here is the code

sqlplus / as sysdba
select * from dual
exit

i use another way but i also get an error
syntax error near unexpected token from' ./V: line 21:select ename from emp;'
the code is

sqlplus -s sys as sysdba < startup
spool on;
spool ashu;
connect scott/tiger
select ename from emp;
spool off;
exit;
EOF
cat ashu 

so do you have any way that you could help me ???

 
0
 

hi lena1990,

what do you do with the variable after assigning it? is it worth assigning it? couldn't you pipe sqlplus to 'what uses the variable' instead?

the first form has to be within backquotes, not backquote and quote.

you really should consider using modern command substitution $( )

 
0
 

what s the moden command subsition could you explain more

 
0
 

modern command substitution is $( )

$ var=$(date +%F)
$ echo "$var"
2012-12-10
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article