SQL statements related to oracle table for deleting Foreign keys

Source: Internet
Author: User

SQL statements related to oracle table for deleting Foreign keys 1. find all the tables that reference a table with the primary key as the foreign key. PK_SRVMONITOR_SERVICE is the primary key name of the table. The SQL code is select c. constraint_name, c. table_name, c. constraint_type, c. r_constraint_name from user_constraints c where c. r_constraint_name = 'pk _ SRVMONITOR_SERVICE 'and c. constraint_type = 'R' 2. delete the FK_BIZSYS_RES_RES_ID foreign key in the SM_BIZSYS_RES TABLE. The SQL code ALTER TABLE SM_BIZSYS_RES DROP CONSTRAINT FK_BIZSYS_RES_RES_ID 3. ADD the primary KEY in the SRVMONITOR_SERVICE TABLE in the CONSTRAINT FK_SM_LASTPERF TABLE as the foreign key SQL code ALTER TABLE ADD CONSTRAINT into FOREIGN KEY (SRV_ID) REFERENCES SRVMONITOR_SERVICE (SRV_ID); 4. find all sequenceJava codes of the current user select 'create sequence '| sequence_name | 'minvalue' | min_value | 'maxvalue' | max_value | 'start with' | last_number | 'crement by '| increment_by | (case when cache_size = 0 then 'nocace' else 'cache' | cache_size end) | '; 'seq from user_sequences

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.