Tuesday, February 13, 2018

Database Constraints

Database Constraints .. 

note:oracle check constraint ( sys_Cn) .. it's oracle managed   .its name generated by system.they might hv not given constraint name while creating the table hence got name from system hence it may differ everytime a table gets recreated.

 Query to check constraint 


Select c1.column_name, c1.position from sys.ALL_CONS_COLUMNS C1, sys.DBA_CONSTRAINTS A1
where A1.table_name = C1.Table_name
and A1.constraint_name = C1.Constraint_Name
--and A1.const raint_type = 'P'
and A1.table_name ='WC_S360_AP_INVOICES_DS'
and C1.owner = A1.Owner
and A1.owner = 'KCIDW'
ORDER BY 2 

No comments:

Post a Comment