I am building a complex query. First here is my query
select LOSA_APP.app_ref_no AS "App.Ref.No."
from losa_app LOSA_APP,
losa_app_z LOSA_APP_Z
where
LOSA_APP.app_status='A'
and
trunc(sysdate) between (nvl(LOSA_APP_Z.li_dt, LOSA_APP_Z.li_collect_dt)) AND ((trunc(sysdate)))
and
(trunc(sysdate) - nvl(losa_app_z.li_dt,losa_app_z.li_collect_dt)) > 90
and
(select losa_app_z.app_ref_no
from losa_app_z
where (trunc(sysdate) - nvl(losa_app_z.li_dt, losa_app_z.li_collect_dt)) > 90
)
The problem is if i run the last query separately or i omit the last query then it is run fine, like if i only run
(select losa_app_z.app_ref_no
from losa_app_z
where (trunc(sysdate) - nvl(losa_app_z.li_dt, losa_app_z.li_collect_dt)) > 90)
but if i run the whole query then i get the error
ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action:
Error at Line: 7 Column: 128
Line 7 is the line at which my last query and is present. What i am doing wrong ? Please help.
(select losa_app_z.app_ref_no from losa_app_z....
Thanks
You should compare result of this query
to something.
For future always try to manage your brackets properly. Count them if necessary.