Advertisement
Fhernd

Consulta3.sql

Sep 5th, 2014
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT NOMBRE_TABLA, NOMBRE_PK, NOMBRE_COL_PK, TIPO_DATO_COL_PK, ORDEN_COL_PK, NUM_IND_COL
  2. FROM
  3. ((
  4. (SELECT cons.TABLE_NAME AS NOMBRE_TABLA, cons.CONSTRAINT_NAME AS NOMBRE_PK, cols.COLUMN_NAME AS NOMBRE_COL_PK, cols.POSITION AS ORDEN_COL_PK
  5. FROM all_constraints cons INNER JOIN  all_cons_columns cols ON cons.constraint_name = cols.constraint_name
  6. WHERE (cons.constraint_type = 'P') AND cons.OWNER = 'PARRANDEROS'))
  7. FULL OUTER JOIN
  8.  (SELECT cons.TABLE_NAME, cons.INDEX_NAME, COUNT(INDEX_NAME) AS NUM_IND_COL
  9. FROM all_tab_columns cols, all_constraints cons
  10.  WHERE cons.TABLE_NAME = cols.TABLE_NAME AND cons.OWNER = 'PARRANDEROS' AND (cons.constraint_type = 'P')
  11. GROUP BY cons.TABLE_NAME,cons.INDEX_NAME)
  12. ON NOMBRE_TABLA = TABLE_NAME)
  13.   FULL OUTER JOIN
  14. (SELECT TND, DATA_TP AS TIPO_DATO_COL_PK
  15. FROM
  16. (SELECT cons.TABLE_NAME AS TND, DATA_TYPE AS DATA_TP
  17. FROM all_constraints cons, all_tab_columns cols
  18. WHERE (cons.constraint_type = 'P') AND cons.OWNER = 'PARRANDEROS' AND cons.table_name = cols.table_name)) ON NOMBRE_TABLA=TND
  19. GROUP BY NOMBRE_TABLA, NOMBRE_PK, NOMBRE_COL_PK,TIPO_DATO_COL_PK, ORDEN_COL_PK, NUM_IND_COL
  20. ORDER BY NOMBRE_TABLA, NOMBRE_PK, TIPO_DATO_COL_PK, ORDEN_COL_PK;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement