Files
mip/Schema/v_current_quote_status.vw
2008-01-29 13:11:12 +00:00

41 lines
1.2 KiB
Plaintext

CREATE OR REPLACE FORCE VIEW v_current_quote_status
AS
SELECT qute_id
,event_date
,qust_code
FROM (SELECT qute_id
,event_date
,qust_code
,decode(qust_code
,'INP'
,1
,'AV'
,2
,'SELREJ'
,3
,'SELECTED'
,5
,'REJECTED'
,6
,'ACCEPTED'
,7
,'LAPSED'
,8) AS this_event
,MAX(decode(qust_code
,'INP'
,1
,'AV'
,2
,'SELREJ'
,3
,'SELECTED'
,5
,'REJECTED'
,6
,'ACCEPTED'
,7
,'LAPSED'
,8)) over(PARTITION BY qute_id) AS max_event
FROM quote_events)
WHERE this_event = max_event
/