I need the proper way to write this sequence:
IF(RM.RM_STD= "LOCKER",50,RM.RM_AREA*RMSTD.COST_OF_SPACE)
Which would basically say that if the room standard is a locker, we charge
$50 - otherwise, take the room area and multiply it by the cost per square
foot. But it doesn't matter how I write it...it's not working! HELP??!!!
i cannot test but your IIf statement "looks" ok so good luck.
regards
FSt1
can any SQL experts confirm this?
Regards
FSt1
"JTurner" wrote:
> I've tried the IIF as well. It keeps returning the error "ORA-00907: missing
> right parthensis". Does that help troubleshoot?
just to check, have you declared a field for the data in the select
statement of the SQL syntax? Might be worth posting the whole SQL statement
so it can be checked, as the iif looked OK.
SELECT RM.BL_ID, RM.FL_ID, RM.RM_ID, RM.AREA, RM.COUNT_EM, DP.NAME,
RM.DP_ID, DV.NAME, RM.DV_ID, RM.RM_CAT, RM.RM_STD, RM.RM_TYPE, RM.RM_USE,
RM.OPTION1, RMSTD.COST_OF_SPACE,
IIF(RM.RM_STD="LOCKER",RMSTD.COST_OF_SPACE,RM.AREA*RMSTD.COST_OF_SPACE)
FROM AFM.DP DP, AFM.DV DV, AFM.RM RM, AFM.RMSTD RMSTD
WHERE RM.DV_ID = DV.DV_ID AND RM.DP_ID = DP.DP_ID AND DP.DV_ID = DV.DV_ID
AND RM.RM_STD = RMSTD.RM_STD
If I write it this way, I get "Incorrect Column Expression":
SELECT RM.BL_ID, RM.FL_ID, RM.RM_ID, RM.AREA, RM.COUNT_EM, DP.NAME,
RM.DP_ID, DV.NAME, RM.DV_ID, RM.RM_CAT, RM.RM_STD, RM.RM_TYPE, RM.RM_USE,
RM.OPTION1, RMSTD.COST_OF_SPACE,
IIF([RM].[RM_STD]="LOCKER",[RMSTD].[COST_OF_SPACE],[RM].[AREA]*[RMSTD].[COST_OF_SPACE])
FROM AFM.DP DP, AFM.DV DV, AFM.RM RM, AFM.RMSTD RMSTD
WHERE RM.DV_ID = DV.DV_ID AND RM.DP_ID = DP.DP_ID AND DP.DV_ID = DV.DV_ID
AND RM.RM_STD = RMSTD.RM_STD
And if I write it this way, I get an "ORA-00936: missing expression" error:
SELECT RM.BL_ID, RM.FL_ID, RM.RM_ID, RM.AREA, RM.COUNT_EM, DP.NAME,
RM.DP_ID, DV.NAME, RM.DV_ID, RM.RM_CAT, RM.RM_STD, RM.RM_TYPE, RM.RM_USE,
RM.OPTION1, RMSTD.COST_OF_SPACE,
IIF([RM.RM_STD]="LOCKER",[RMSTD.COST_OF_SPACE],[RM.AREA]*[RMSTD.COST_OF_SPACE])
FROM AFM.DP DP, AFM.DV DV, AFM.RM RM, AFM.RMSTD RMSTD
WHERE RM.DV_ID = DV.DV_ID AND RM.DP_ID = DP.DP_ID AND DP.DV_ID = DV.DV_ID
AND RM.RM_STD = RMSTD.RM_STD