on 07-16-2015 7:42 AM
Hi Friends,
I know when Creating Table we define Primary and Foriegn keys (With system generated Constraint names like _SYS_CONSTRAINT_xxxxx_#xx_#F0)
And also we can view them by using following SQL Syntax
---For Primary key
SELECT * FROM “SYS”."CONSTRAINTS" WHERE SCHEMA_NAME = 'TEST';
---For foreign key
SELECT * FROM "SYS"."REFERENTIAL_CONSTRAINTS"WHERE SCHEMA_NAME = 'TEST';
Also we can assign names of these CONSTRAINTS if we they are created using ALTER COMMENDS.(Example given below)
ALTER TABLE Orders
ADD CONSTRAINT fk_PerOrders
FOREIGN KEY (P_Id)
REFERENCES Persons(P_Id)
NOTE:Here fk_PerOrders is the name of foreign key constraint given by me
Based on My knowledge we are able to define CONSTRAINT with CUSTOM NAMES only after creating tables by the use of ALTER TABLE.
My question Is Can we create CONSTRAINTS with CUSTOM NAMES while CREATING the TABLE itself.
regards
Nagarjuna
The documentation is not lying on this one. It's not possible to provide custom names to constraints within the CREATE TABLE command.
You can do that only with the ALTER TABLE command.
No need to SHOUT or to abuse the text formatting...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.