on 12-21-2011 12:05 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.