Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the sequence naming conventions in Oracle

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about the sequence naming conventions in Oracle. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

1. The establishment of sequence:

Create sequence "TEST_SEQUENCE" increment by 1 start with 1 nomaxvalue nocycle nocache

Description: the last three values can be set by yourself.

2. The establishment of trigger:

Create trigger "test_trigger" before

Insert on test_table for each row when (new.id is null)

Begin

Select TEST_SEQUENCE.nextval into:new.id from dual

End

Note: when creating a sequence, it is best to write the name of the sequence in uppercase, although oracle will convert it automatically, but recently in the

When using it, we did not pay attention to it, and the lowercase sequence names were not converted to uppercase, thus causing errors! The situation is as follows:

At that time, the sequence name was written in lowercase, and the system did not convert uppercase, so that it would appear when the trigger was created: trigger.

The establishment is successful, but the prompt "there is a warning at compile time", which eventually leads to the trigger not being used properly. The solution is to change the name of the sequence.

Change to uppercase.

This is what the sequence naming conventions in Oracle shared by the editor are. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report