what am I missing?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting what am I missing?
# 1  
Old 06-13-2005
Data what am I missing?

I have the following portion of a script

Code:
Check()
{
echo "\n\nChecking that all constraints are Enabled"
echo "..."
sleep 2
CHECK_COUNT='sqlplus -s $1 <<-EOSQL4
set feed off pause off pages 0 head off;
set linesize 150 echo off;
select count(*) from user_constraints where status='DISABLED';"
quit;
EOSQL4'

if [ $CHECK_COUNT -eq 0 ]
then
    echo "\nThe following $CHECK_COUNT constraint(s) could not be enabled!"
    #sqlplus -s $1 <<-EOSQL
    #set feed off pause off pages 0 head off;
    #spool ref_con_errors.log;
    #select constraint_name,table_name from user_constraints where status='DISABLED';
    #spool off;
    #quit;
    #EOSQL
    #echo "\nPlease view 'ref_con_errors.log' for details on which constraints"
    echo ""
else
    echo "\nAll Constraints are enabled"
    echo ""
fi
}

this is the output I get from it:

Checking that all constraints are Enabled
...
Check[12]: -s: unknown test operator

All Constraints are enabled


How do I get rid of this error?

Thanks,
Zelp
# 2  
Old 06-13-2005
Code:
CHECK_COUNT='sqlplus -s $1 <<-EOSQL4
set feed off pause off pages 0 head off;
set linesize 150 echo off;
select count(*) from user_constraints where status='DISABLED';"
quit;
EOSQL4'

See the two red tick marks - they need to be backtick characters.
Remove the red dash
# 3  
Old 06-13-2005
i tried that and now I get

Checking that all constraints are Enabled
...
Check[12]: ORA-01740:: unknown test operator

All Constraints are enabled


anymore help?
# 4  
Old 06-13-2005
Code:
if [ "$CHECK_COUNT" -eq 0 ]

also it seems like your sql does not return a NUMBER.... debug it stand-alone first.

select count(*) from user_constraints where status='DISABLED';"
# 5  
Old 06-13-2005
yeah, it was that darn quote after 'DISABLED';

and BTW, you can leave the (minus) in the <<-EOSQL4

by adding the minus it removes any un-wanted TAB characters in the SQL.

Thanks so much guys!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Missing cout

Heyas Me trying some C.. cout in specific, thats what i remembered: #include <stdio.h> // -- Just the above or with all the below ones, no change #include <stdio_ext.h> #include <stdlib.h> #include <wchar.h> //#include <iostream> // I assume its the same anyway? //#include <iostream.h>... (2 Replies)
Discussion started by: sea
2 Replies

2. Red Hat

Yum - resolving missing dependencies that are not missing

I am trying to install VirtualBox on RHEL 5 but I need the 32 bit version for 32 bit Windows. When I run yum I get the following: sudo yum localinstall /auto/spvtg-it/spvss-migration/Software/VirtualBox-4.3-4.3.2_90405_el6-1.i686.rpm Loaded plugins: fastestmirror Setting up Local Package... (13 Replies)
Discussion started by: gw1500se
13 Replies

3. SuSE

How to resolve missing missing dependencies with opensuse 11.3 and 12.3?

Hello, This is a programming question as well as a suse question, so let me know if you think I should post this in programming. I have an application that I compiled under opensuse 12.2 using g77-3.3/g++3.3. The program compiles and runs just fine. I gave the application to a colleague who... (2 Replies)
Discussion started by: LMHmedchem
2 Replies

4. Shell Programming and Scripting

Need help looking for missing hours.

I have a file that should cover a days worth of stats, at the beginning of each 15 minute report I have a unique header that looks like the below example. The "0000" and "0015" will change in the header line to show which 15 Minute interval the report is covering and of course from day to day the... (7 Replies)
Discussion started by: fsanchez
7 Replies

5. Shell Programming and Scripting

[: missing `]'

Hi, I am getting this error while running the following code. i=`awk '{print $2}' test1.txt` j=`awk '{print $4}' test1.txt` k=`awk '{print $6}' test1.txt` if ; then echo "Up." else echo "down" fi rm -f test.txt test1.txt error is this: line 12: ' Please suggest. (2 Replies)
Discussion started by: arijitsaha
2 Replies

6. Linux

library missing

Hi, I am trying migrate webmin application from solaris to linux. But that is not working in Linux. because the library librpcsoc.so has missed in Linux box.. Could you please advice me that how to resolve this issue and also that how to install that library as well. (1 Reply)
Discussion started by: Mani_apr08
1 Replies

7. UNIX for Dummies Questions & Answers

missing scrollbar

Hi, My tcsh window doesn't have a scrollbar, so I don't get a lot of history! Can you help to get scrollbar? Thanks (3 Replies)
Discussion started by: parisa_3456
3 Replies

8. Solaris

missing libsunmath.so.1

Hi, I have an application which requires libsunmath.so.1, however; my os version seems to be missing this file (find from root level did not return anything). Version: SunOS 5.10 where can I get this file? thanks, (1 Reply)
Discussion started by: orahi001
1 Replies

9. HP-UX

missing disk

Hi Everyone I am having hard drive problems with a C3000 Visualize workstation. The machine has two 9.1Gb disks. One dedicated to the OS 11i and the other containing one lvol /space. When I boot up the second disk can be seen in sam but nowhere else, ie cd /space freezes. I fear that on boot... (3 Replies)
Discussion started by: C3000
3 Replies
Login or Register to Ask a Question