Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. DELIMITER //
  2. CREATE PROCEDURE country_hos
  3. (IN requested_column_name CHAR(20), IN requested_referenced_table_name CHAR(20))
  4. BEGIN
  5. select distinct table_name
  6. from information_schema.columns
  7. where (
  8. table_schema = 'usa'
  9. and column_name = requested_column_name
  10. and table_name not in (SELECT table_name FROM information_schema.key_column_usage WHERE referenced_table_name = requested_referenced_table_name AND table_schema = 'usa')
  11. and table_name not in (select table_name from information_schema.tables where table_rows = 0 and table_schema = 'usa'))
  12. END //
  13. DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement