以下のクエリからより効率的かつエレガントな方法で MY_LATEST_INSERTED_NUMBER_BASING_ON_MY_DATE_COLUMN_FOR_ID_CONTEXT を取得するにはどうすればよいですか?
SELECT MAX(MY_DATE_COLUMN),
ID,
listagg(SOME_COLUMN, '') within GROUP (ORDER BY MY_DATE_COLUMN),
SUBSTR(
listagg(MY_NUMBER, ';') within GROUP (ORDER BY MY_DATE_COLUMN DESC),
1,
instr(
listagg(MY_NUMBER, ';') within GROUP (ORDER BY MY_DATE_COLUMN DESC),'-') - 1
) as MY_LATEST_INSERTED_NUMBER_BASING_ON_MY_DATE_COLUMN_IN_ID_CONTEXT
FROM MY_TABLE
GROUP BY ID;