sql - selecting with nvl function -
i have query :
select w.worker_id, w.lastname,pd.invalid workers w,personal_data pd pd.worker_id (+) = w.worker_id , nvl(pd.invalid,'n')='y'
i have check box (y,n), purpose of check box list invalids if checked , when not checked normal workers including invalids. invalid list.
and select :
select w.worker_id, w.lastname,pd.invalid workers w,personal_data pd pd.worker_id (+) = w.worker_id , pd.invalid =nvl(:p_invalid,pd_invalid)
if checkbox y invalid workers , when not checked (n) normal workers, need when n workers ( invalid , normal ).
stop using (+)
syntax! use proper, explicit outer joins.
however, don't think need outer join -- comparison constant undoes anyway. think want:
select w.worker_id, w.lastname, pd.invalid workers w join personal_data pd on pd.worker_id = w.worker_id (:p_invalid = 'n' or pd.invalid = :p_invalid);
Comments
Post a Comment