In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the database constraints of validate and able how to use, the article is very detailed, has a certain reference value, interested friends must read it!
Create a uniqueness constraint and automatically create the same uniqueness index as the constraint name
Create a check constraint without generating an index
Create a foreign key constraint without generating an index
Enable constraints:
Enable (validate): enable constraints, create indexes, and enforce constraints on existing and newly added data.
Enable novalidate: enable constraints, create indexes, and enforce constraints only on newly added data, regardless of existing data in the table.
Disable constraints:
Disable (novalidate): close the constraint, delete the index, and modify the data of the constraint column.
Disable validate: close constraints, delete indexes, and cannot insert / update / delete tables.
Where enable\ validate is used.
1. When the materialized view is to realize query rewriting, the state of the primary foreign key constraint of the associated table must be guaranteed to be enable and validate.
2. To achieve star conversion, we must ensure that the state of the foreign key constraint of the fact table, that is, the field of the main table, is enable and validate.
SQL > alter table SALES disable novalidate constraint SALES_CHANNEL_FK
Table altered.
SQL > select constraint_name,constraint_type,status,validated from user_constraints where table_name='SALES' and constraint_type='R' and CONSTRAINT_NAME='SALES_CHANNEL_FK'
CONSTRAINT_NAME CONSTRAINT_TYPE STATUS VALIDATED
--
SALES_CHANNEL_FK R DISABLED NOT VALIDATED
SQL > alter table SALES disable validate constraint SALES_CHANNEL_FK
Table altered.
SQL > select constraint_name,constraint_type,status,validated from user_constraints where table_name='SALES' and constraint_type='R' and CONSTRAINT_NAME='SALES_CHANNEL_FK'
CONSTRAINT_NAME CONSTRAINT_TYPE STATUS VALIDATED
--
SALES_CHANNEL_FK R DISABLED VALIDATED
SQL > alter table SALES enable novalidate constraint SALES_CHANNEL_FK
Table altered.
SQL > select constraint_name,constraint_type,status,validated from user_constraints where table_name='SALES' and constraint_type='R' and CONSTRAINT_NAME='SALES_CHANNEL_FK'
CONSTRAINT_NAME CONSTRAINT_TYPE STATUS VALIDATED
--
SALES_CHANNEL_FK R ENABLED NOT VALIDATED
SQL > alter table SALES enable validate constraint SALES_CHANNEL_FK
Table altered.
SQL > select constraint_name,constraint_type,status,validated from user_constraints where table_name='SALES' and constraint_type='R' and CONSTRAINT_NAME='SALES_CHANNEL_FK'
CONSTRAINT_NAME CONSTRAINT_TYPE STATUS VALIDATED
--
SALES_CHANNEL_FK R ENABLED VALIDATED
The above is all the contents of the article "how to use validate and able with constraints in the database". Thank you for reading! Hope to share the content to help you, more related knowledge, 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.