At times when we have two
similar blocks in oracle forms, we might have to provide a copy button, which
will be used to copy the contents of block1 to block2. If we are talking about
single record block, then there is not issue at all. But if the blocks are
multi record blocks then we have to write a routine which will read from block one,
and copy to block 2 and at the same time has to take care of moving to next
record after each record is copied.
The below piece of code does
just the same, for a two column block.
BEGIN
GO_BLOCK(BLOCK1);
FIRST_RECORD;
WHILE : BLOCK1.COLUMN1 IS NOT NULL
LOOP
GO_BLOCK(BLOCK2);
: BLOCK2.COLUMN1 := : BLOCK1.COLUMN1;
: BLOCK2.COLUMN2 := : BLOCK1.COLUMN2;
NEXT_RECORD;
GO_BLOCK(BLOCK1);
NEXT_RECORD;
END
LOOP;
GO_BLOCK(BLOCK2);
FIRST_RECORD;
GO_BLOCK(BLOCK1);
FIRST_RECORD;
END;