Teradata to Oracle Query
729919Oct 24 2009 — edited Oct 25 2009HI,
I have this query in teradata for which i need to convert into oracle but am unable to.
INSERT INTO TABLE1
(
COD_APPL_SOUR,
IDNT_SOUR_ACCS,
DAT_DEBT_ETT,
HEUR_DEBT_ETT,
COD_MOTF_CHNG_ETT,
DAT_FIN_ETT,
HEUR_FIN_ETT,
COD_ETT_ACCS
)
SELECT
S.COD_APPL_SOUR,
S.IDNT_SOUR_ACCS,
S.DAT_DEBT_ETT,
S.HEUR_DEBT_ETT,
S.COD_MOTF_CHNG_ETT,
S.DAT_FIN_ETT,
S.HEUR_FIN_ETT,
S.COD_ETT_ACCS
FROM
TABLE2 S
WHERE
S.COD_APPL_SOUR = 'CA'
GROUP BY 1,2
qualify csum (1, DAT_DEBT_ETT desc, HEUR_DEBT_ETT desc ) = 1
Basically, there is no primary key defined on the table. So the query wants to retrieve the latest record for a particular person based on the date and time from the table.
If anyone could give their thoughts it would be great!
Thnks!