Table not having index on fk column - Oracle Database Script. SELECT * FROM (SELECT c.table_name, co.column_name, co.position column_position FROM user_constraints c, user_cons_columns co WHERE c.constraint_name = co.constraint_name AND c.constraint_type = 'R' MINUS SELECT ui.table_name, uic.column_name, uic.column_position FROM user_indexes ui, user_ind_columns uic WHERE ui.index_name = uic.index_name ) ORDER BY TABLE_NAME, column_position; SELECT a.constraint_name cons_name , a.table_name tab_name , b.column_name cons_column , nvl(c.column_name, '***No Index***') ind_column FROM user_constraints a JOIN user_cons_columns b ON a.constraint_name = b.constraint_name LEFT OUTER JOIN user_ind_columns c ON b.column_name = c.column_name AND b.table_name = c.table_name WHERE constraint_type = 'R' ORDER BY 2, 1;
SELECT * FROM (SELECT c.table_name, co.column_name, co.position column_position FROM user_constraints c, user_cons_columns co WHERE c.constraint_name = co.constraint_name AND c.constraint_type = 'R' MINUS SELECT ui.table_name, uic.column_name, uic.column_position FROM user_indexes ui, user_ind_columns uic WHERE ui.index_name = uic.index_name ) ORDER BY TABLE_NAME, column_position; SELECT a.constraint_name cons_name , a.table_name tab_name , b.column_name cons_column , nvl(c.column_name, '***No Index***') ind_column FROM user_constraints a JOIN user_cons_columns b ON a.constraint_name = b.constraint_name LEFT OUTER JOIN user_ind_columns c ON b.column_name = c.column_name AND b.table_name = c.table_name WHERE constraint_type = 'R' ORDER BY 2, 1;