Select Oracle Bank - Constraint

1

Good morning, if anyone can help me, I need a query that returns me the constraints of a table and its data types. I'm trying to set up a procedure generator to facilitate, it takes a lot of time to create procedures. In this select it does not bring me the data type.

SELECT DISTINCT SYS.USER_CONS_COLUMNS.COLUMN_NAME FROM USER_CONSTRAINTS NATURAL JOIN SYS.USER_CONS_COLUMNS WHERE TABLE_NAME = 'PRODSERV';
    
asked by anonymous 16.06.2016 / 15:48

1 answer

0

In a single query it is not possible, but in two or more it would look like this:

select COLUMN_NAME, DATA_TYPE from 
all_tab_columns where table_name = 'TABELA' 

SELECT constraint_name, constraint_type  
from user_constraints where table_name = 'TABELA'


SELECT constraint_name, constraint_type, column_name
from user_constraints natural join user_cons_columns
where table_name = 'TABELA'
    
16.06.2016 / 16:30