Input:
NONDUP_REC:
DUP_REC:
DUP_RECORDS_SPLIT Data:
INSERT FIRST
WHEN RNK = 1 THEN
INTO NONDUP_REC VALUES (SID,SNAME,MARKS)
ELSE
INTO DUP_REC VALUES (SID,SNAME,MARKS)
SELECT * FROM
(SELECT SID,SNAME,MARKS, COUNT(SID) OVER (PARTITION BY SID ORDER BY SID) RNK FROM DUP_RECORDS_SPLIT);
COMMIT;