Trigger for creating table Sequence

Source: Internet
Author: User
When a trigger is used to create a sequence of tables and directly paste data into the table, the sequence fields are automatically generated and viewed in the following ways: 1. Trigger user name. table name_trg, view can see the code of the corresponding trigger 2. view the corresponding table to see the final trigger segment, you can see the enable trigger implementation code createorreplacetriggercux. c

When a trigger is used to create a sequence of tables and directly paste data into the table, the sequence fields are automatically generated and viewed in the following ways: 1. Trigger user name. table name_trg, view can see the code of the corresponding trigger 2. view the corresponding table to see the final trigger segment, you can see the enable trigger implementation code create or replace trigger cux. c

Sequence sequence create table sequence trigger FunctionWhen you paste data directly to the table, the sequence fields are automatically generated. View MethodGenerally: 1. trigger username. Table name_trg. view will be able to see the code of the corresponding trigger. 2. view the final trigger segment through the corresponding table of view to see the trigger of enable. Implementation Code
Create or replace trigger cux. cux_rebate_line_trg before insert on cux. cux_rebate_line for each rowdeclare l_id number; begin select cux_rebate_line_s.nextval into: new. line_id from dual; exception when others then raise_application_error (-20100, 'Get _ sequence_nextval error' | sqlerrm); end;
Description1. The created trigger must be created under the user of the corresponding table. 2. It is recommended that the name of the table + _ TRG3 and into be: new. columns that need to automatically generate the sequence

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.