Copies the value of each item in the record with the next lower sequence number to the corresponding items in the current record. The current record must not correspond to a row in the database. If it does, an error occurs.
Note: The duplicate record does not inherit the record status of the source record; instead, its record status is INSERT.
PROCEDURE DUPLICATE_RECORD;
Built-in Type restricted procedure
Enter Query Mode no
None.
A previous record must exist in your current session.
/*
** Built-in: DUPLICATE_RECORD;
** Example: Make a copy of the current record and increment
** the "line_sequence" item by one.
*/
DECLARE
n NUMBER;
BEGIN
/*
** Remember the value of the 'line_sequence' from the
** current record
*/
n := :my_block.line_sequence;
/*
** Create a new record, and copy all the values from the
** previous record into it.
*/
Create_Record;
Duplicate_Record;
/*
** Set the new record's 'line_sequence' to one more than
** the last record's.
*/
:my_block.line_sequence := n + 1;
END;