1 Reply Latest reply: Dec 21, 2011 10:32 AM by Michael Eaton RSS

Information Steward - Data Quality Rules - SQL clause - Parameters

Gary Scott
Currently Being Moderated

When I use the SQL clause in Information Steward to build a rule, how do I include the Parameter Values witin the SQL statement that I want to run ?

 

I keep getting the error message :

      Referencing undeclared variable <$P_Stock_Code>. Declare the variable in the context it is being used in.. Declare the variable in the context it is being used in. (COR-10690)

 

This is in DB2 UDB v9. Not sure if similar for Oracle / SQLServer.

 

Here is the Rule Code

 

BEGIN

      RETURN SQL('F0DB27', 'Select CASE count(*)

WHEN 1 THEN "YES"

ELSE "NO"

END, TWSTK.STOC_C_N, Count(*)

from F0DB27.TWSTK as TWSTK

Where TWSTK.Stoc_c_n = [$P_Stock_Code]

Group by TWSTK.Stoc_c_n') = 'YES';

END

 

$P_Stock_Code is the Parameter that is declared..

 

Any help to understand this would be appreciated as I will need to create several more complex rules where SQL will be a MUST have item.

 

Cheers

Actions