cancel
Showing results for 
Search instead for 
Did you mean: 

Information Steward - Data Quality Rules - SQL clause - Parameters

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello

Try ths - if the variable/parameter/column is a character type surround it with { }, if its a numeric use [ ]. In Data Services this dereferences the variable and the { } conveiniently inserts quotes around the value.

M