大家有见过把NVL() , DECODE() 函数写到WHERE 后面吗?
这样写可以吗
我写了总是在提示"没有结束标记,语句不正确"
SELECT fd.department_name, fc.cate_name, fdh.newid, fdh.nfixname, fdh.qty,
fdh.getdate, fdh.pledge, fdh.getcost, fdh.fixamt, fdh.rcost,
fdh.depcost, fdh.depyear, fdh.depmon, fdh.yeardep, fdh.deptot,
fdh.getcost + fdh.fixamt - deptot, fdh.input
FROM fams_document_heads fdh, fa_cate fc, fams_department fd
WHERE fc.cate_no = fdh.mainid AND fdh.ndepid = fd.department_no
NVL2(&sDate, and fdh.GETDATE between to_date(sDate, 'yyyy-mm-dd') and to_date(&fDate, 'yyyy-mm-dd') , and 1=1 )
我刚改了一下:
SELECT fd.department_name, fc.cate_name, fdh.newid, fdh.nfixname, fdh.qty,
fdh.getdate, fdh.pledge, fdh.getcost, fdh.fixamt, fdh.rcost,
fdh.depcost, fdh.depyear, fdh.depmon, fdh.yeardep, fdh.deptot,
fdh.getcost + fdh.fixamt - deptot, fdh.input
FROM fams_document_heads fdh, fa_cate fc, fams_department fd
WHERE fc.cate_no = fdh.mainid AND fdh.ndepid = fd.department_no /*and 1=1*/
and NVL2(&sDate, fdh.GETDATE between to_date(sDate, 'yyyy-mm-dd') and to_date(&fDate, 'yyyy-mm-dd') , 1=1 )
还是报错:
invalid number of arguments