Page 1 of 1

Impact Analysis - Like & Equal in command

Posted: Thu Oct 16, 2008 3:33 pm
by nkln@you
I am not able to get desired results using the following the command:


SELECT NAME FMT '50L', CATEGORY FMT '60L' FROM DS_JOBS WHERE JOBNO IN (SELECT OBJIDNO FROM DS_JOBOBJECTS WHERE EVAL 'UPCASE(@RECORD)' = '$Table')

$Table is parameter passed in shell script

But when I use LIKE instead of '=', I am getting results.
i.e EVAL 'UPCASE(@RECORD)' = '$Table' is not working but EVAL 'UPCASE(@RECORD)' LIKE '%$Table%' IS WORKING
I want to search for exact name but not for strings. Is there a way using above command?

Posted: Thu Oct 16, 2008 3:52 pm
by ray.wurlod
You are already searching for an exact match because '$Table' does not include any wildcard character. LIKE is necessary because you are comparing against the entire DS_JOBOBJECTS record which will never have the value '$Table' alone.

Posted: Thu Oct 16, 2008 4:00 pm
by nkln@you
But when I use EVAL 'UPCASE(@RECORD)' LIKE '%$Table%'. I get results which I do not require. Suppose I am seraching for Word FACT_CLAIMS.

LIKE would give me jobs where FACT_CLAIMS_BACKLOG, FACT_CLAIMS _DEFRRED is used along with FACT_CLAIMS.

I want only jobs which has the exact word FACT_CLAIMS.

Posted: Thu Oct 16, 2008 4:14 pm
by ray.wurlod
Then you need to add more filtering, as suggested below, or to construct complete metadata for the DS_JOBOBJECTS table so that you can query individual columns therein separately. The vendor has elected not to provide that metadata, so you need to construct the same based on your own researches. Here is one way to handle your specific example.

Code: Select all

EVAL "@RECORD" LIKE '%FACT\_CLAIMS%' AND EVAL "@RECORD" NOT LIKE '%FACT\_CLAIMS\_%' ESCAPE '\'