1753519 Members
5093 Online
108795 Solutions
New Discussion юеВ

scripting

 
SOLVED
Go to solution
heb
Occasional Advisor

scripting

Hi

My first question so please excuse my inexperience.
I write scripts that always seems require sqlplus. To monitor for errors I run my sql within a variable and then do checks on the variable searing for string to determine failure or not. This all works well normally.
My problem is that for this one script I am getting a <scriptname>[36]: no space message displayed. The offending lines are as follows
SQLRESULTS=`/u01/app/oracle/product/8.0.6/bin/sqlplus -S xxxx/xxxxxxxx @$scriptname $scriptoutput < /tmp/endsql.txt`
This is where the results from sqlplus are held
print $SQLRESULTS | grep -q "ORA-"
This is where I search for oracle errors
<scriptname>[36]: no space
This is the error message from unix. Unix doesn't seem to like me displaying the results of variable SQLRESULTS and grep 'ing it due to a size restriction
Can someone please advise.

Thanks

heb
2 REPLIES 2
Stuart Browne
Honored Contributor
Solution

Re: scripting

Why not just output the 'sqlplus' command to a temporary file, and grep that?


TMPFILE=/tmp/$$.tmp
/u01/app/oracle/product/8.0.6/bin/sqlplus -S xxxx/xxxxxxxx @$scriptname $scriptoutput < /tmp/endsql.txt > $TMPFILE
grep -q "ORA-" $TMPFILE
....
rm $TMPFILE

This will do away with the need to have a large amount of environment space allocated.
One long-haired git at your service...
heb
Occasional Advisor

Re: scripting

Thanks Stuart

I got caught up trying to solve the no space message rather than taking a step back and going for the simple solution.