What is the best way to use the Orders_Seq sequence to assign order ID numbers so that these requirements are met?

Order_Id is the primary key for the ORDERS table. A sequence called Orders_Seq has been created for order ID numbers.
You are designing a form that performs transactions on the ORDERS table. Users will be able to insert, update, delete, and query records using this form. Gaps in order ID numbers in the ORDERS table should be kept to a minimum. After the order ID number is assigned to a newly created record, it should be displayed in the form without requerying the data.
What is the best way to use the Orders_Seq sequence to assign order ID numbers so that these requirements are met?

Order_Id is the primary key for the ORDERS table. A sequence called Orders_Seq has been created for order ID numbers.
You are designing a form that performs transactions on the ORDERS table. Users will be able to insert, update, delete, and query records using this form. Gaps in order ID numbers in the ORDERS table should be kept to a minimum. After the order ID number is assigned to a newly created record, it should be displayed in the form without requerying the data.
What is the best way to use the Orders_Seq sequence to assign order ID numbers so that these requirements are met?

A.
Set the Initial Value for the Orders.Order_Id item to:
SEQUENCE.ORDERS_SEQ.NEXTVAL.

B.
Put the following code into a Pre-Inserted trigger:
:Orders.Order:Id := :SEQUENCE.ORDERS_SEQ_NEXTVAL;

C.
Put the following code into a Pre-Inserted trigger:
SELECT orders_seq.NEXTVAL INTO :Orders.Order_Id
FROM sys.dual;

D.
Put the following code into a When-Create-Record trigger:
:Orders.Order_Id := :SEQUENCE.ORDERS_SEQ.NEXTVAL;

E.
Put the following code into a When-Create-Record trigger:
SELECT orders_seq.NEXTVAL INTO :Orders.Order_Id
FROM sys.dual;



Leave a Reply 0

Your email address will not be published. Required fields are marked *