How to implement the automatic numbering (line number) function in Oracle form

Source: Internet
Author: User

Method One,
Just define the "ordinal" as a formula, and set the formula to: Get_block_property (' Block_name ', Current_record) can be implemented, or put this line of statements into the "When-create-record" trigger.
Disadvantage: The line number cannot be refreshed automatically when the increment is deleted.


Method Two,
Add the appropriate code to the block's three triggers:
Key-crerec:

DECLARE Line Number;BEGINLine :=: SYSTEM.  Cursor_record; LOOPIF: SYSTEM. Last_record= 'TRUE'  Then EXIT; ELSENext_record; : blk.id:=: SYSTEM. Cursor_record+ 1; END IF; ENDLOOP;  Go_record (line);  Create_record; : blk.id:=: SYSTEM. Cursor_record;END;

Key-delrec:

DECLARE Line Number;BEGINDelete_record; Line:=: SYSTEM.  Cursor_record; LOOP:blk.ID:=: SYSTEM. Cursor_record; IF: SYSTEM. Last_record= 'TRUE'  Then EXIT; ELSENext_record;END IF; ENDLOOP; Go_record (line);END;

When-create-record:

: blk.id:= : SYSTEM. Trigger_record;

Disadvantage: For a table with a small number of records, when there are many records in table, because of the use of cyclic operation, it will affect efficiency.
To prevent the F11 from being generated by an ordinal, which affects the query, the following conditions can be added before the build:
IF (: SYSTEM. MODE! = ' enter-query ') then

How to implement the automatic numbering (line number) function in Oracle form

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.