AnsweredAssumed Answered

Issue with SQL query or default values for parameters in a linked table PI AF

Question asked by zhumar on May 20, 2020
Latest reply on May 20, 2020 by LalBabuShaik

I would like to create a linked table in PI AF. Some values are from an Oracle table, some other are static.

 

As you can see example on the screenshot below, I’m using parameters to set static values for 3 columns (INJ_RATE_AT_MAIP, HIGH_PRESS_TRIP_ALARM, INJ_RATE_AT_HPT) depending on the value of object_code:

 

 

I get this table:

 

SQL query:

SELECT DAYTIME, OBJECT_CODE, BH_PRESS, WH_PRESS, MAX_INJ_PRESS, INJ_RATE_AT_MAIP, HIGH_PRESS_TRIP_ALARM, INJ_RATE_AT_HPT  FROM (

select  DAYTIME, OBJECT_CODE, BH_PRESS, WH_PRESS, MAX_INJ_PRESS, @MAIP107 as INJ_RATE_AT_MAIP, @ALARM107 as HIGH_PRESS_TRIP_ALARM, @HPT107 as INJ_RATE_AT_HPT from DV_IWEL_GAS_DATA where object_code = '107'

UNION

select  DAYTIME, OBJECT_CODE, BH_PRESS, WH_PRESS, MAX_INJ_PRESS, @MAIP126 as INJ_RATE_AT_MAIP, @ALARM126 as HIGH_PRESS_TRIP_ALARM, @HPT126 as INJ_RATE_AT_HPT from DV_IWEL_GAS_DATA where object_code = '126'

)

 

 

But when I set values for parameters equal or bigger than 100, I get the error:

 

However, if I use the following query with 3-digit numbers, then it works:

                select object_code, @MAIP107 as INJ_RATE_AT_MAIP, @ALARM107 as HIGH_PRESS_TRIP_ALARM  from DV_IWEL_GAS_DATA where object_code = '107'

 

I think, maybe it's need to modify the SQL query somehow, but I can't figure out. I will appreciate any advice.

 

Thanks.

Outcomes