I have a SP used to calculate a new record (LINE) based on the parameters passed for @PLN and @LN and @OPER(+ or -). The values are in the same table so I join the table to itself. The problem I have is when one of the lines passed does not exists it (obviously ) doesn't do the calculation, is there a way I can pass a 0 value for the record that doesn't exist, so the calculation will caculate the one value + 0 amount? Here's my code
So the EXEC sql command would look something like sp_addLines 3,1,'+',2 (add lines 1 and 2 to become line 3)
So the EXEC sql command would look something like sp_addLines 3,1,'+',2 (add lines 1 and 2 to become line 3)
Code:
SELECT PERIOD, A.ORG_ENTRY_HANDLE,(@LN,5,0)
,
(ISNULL(A.ACTUAL_PRYR,0) '+ @OPER + ' ISNULL(B.ACTUAL_PRYR,0))
FROM T_FDW_CSMDM_CFL_DATA_ALL A, T_FDW_CSMDM_CFL_DATA_ALL B
WHERE A.LINE_NUMBER = STR(@LN_A,5,0)
AND B.LINE_NUMBER = STR(@LN_B,5,0)
AND A.ORG_ENTRY = B.ORG_ENTRY