The syntax is database brand specific. I will show Oracle examples because most people use that brand database.
Please see:
Syntax One:
SEE:
/* <== Comments start like this and end like this ==> */
/* NVL(parm1,parm2) convert parm1 to parm2 value if null */
/* so now I don't need to check for NULL */
/* DECODE is an If parm1 = parm2 then parm3 else parm4 */
/* just count the parms */
DECODE(NVL(REPORTS.V_PAYDATA_ALL.TEMPRATE,0),
0,(REPORTS.V_EMPLOYEE.RATE1AMT * REPORTS.V_PAYDATA_ALL.REGHOURS),
REPORTS.V_PAYDATA_ALL.TEMPRATE)
Syntax Two:
CASE NVL(REPORTS.V_PAYDATA_ALL.TEMPRATE,0)
WHEN 0 THEN (REPORTS.V_EMPLOYEE.RATE1AMT * REPORTS.V_PAYDATA_ALL.REGHOURS)
ELSE REPORTS.V_PAYDATA_ALL.TEMPRATE
END
SEE:
Specializing in ReportSmith Training and Consulting