I created a stored procedure with a query containing a nested subselect:
I compiled this on my home machine running 9i, but when I tried it on a work machine running against ORA 8.0.5 server, that says ENC_STAT is not part of the grouping. Is this really a difference between versions? If so, is there anyway to write this so it works with 8? Or am I doing something wrong?
Thanks
Bob Hagan
Code:
SELECT C.CLIENT_NM, C.CLIENT_ID,
Max(decode(substr(s.STATUS,1,2),'N-', s.Status_dt, null)) "LastRefer_Dt",
Max(decode(substr(e.ENC_TYPE,1,4),'INIT', e.END_DT, null)) "LastInitVisit_Dt",
[COLOR=red] (select ENC_STAT from encountr where encountr.end_dt = (select max(decode(substr(encountr.ENC_TYPE,1,4), 'INIT', encountr.end_dt, null)) from encountr where encountr.client_id = c.client_id)) "InitVisitStatus" [/color red]
FROM
CLIENT C,
STATUS S,
ENCOUNTR E
WHERE ...
GROUP BY ...
I compiled this on my home machine running 9i, but when I tried it on a work machine running against ORA 8.0.5 server, that says ENC_STAT is not part of the grouping. Is this really a difference between versions? If so, is there anyway to write this so it works with 8? Or am I doing something wrong?
Thanks
Bob Hagan