Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

unix shell scripting and ORACLE

$
0
0
Hi ,

I have generate a dynamic sql query in unix and i want to run that generated sql query on unix
box.But when i have tried to run this its shows error because ther is a space in the generated
sql...Please assist

for example:

code_list=`sqlplus -s Test/test123 <<EOF
set heading off
set pagesize 0
set tab off
set feedback off
select decode(rownum, 1, ' ', 'union ') ||'select distinct '''||trial_name||''' as Schema_Name,
viewname from '||trial_name||'.CA_DATA a where view
name not in(select distinct object_name from dba_objects a
where a.owner='''||trial_name ||''' and (a.object_name like ''CV%''))'
from (
select distinct owner as trial_name from dba_objects
where owner like 'MK%'
or OWNER like 'V%')
/
exit
EOF`
sqlplus -s Test/test123 <<EOF
$code_list ;
exit
EOF`



in this query we first connect with DB and put the sql value in the variable.

and then i want to run that variable(code_list).this variable contain the sql query.I just want to
run the quey in code_list variable .but its not runing due to spce issue in the genearated dynamic
query.

Please assist.it's a very critical request.


Thanks for you help in advance.I am waiting for ur responce.

Regards,
Vikas

Viewing all articles
Browse latest Browse all 13329

Trending Articles