Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DELIMITER //
- CREATE PROCEDURE country_hos
- (IN requested_column_name CHAR(20), IN requested_referenced_table_name CHAR(20))
- BEGIN
- select distinct table_name
- from information_schema.columns
- where (
- table_schema = 'usa'
- and column_name = requested_column_name
- 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')
- and table_name not in (select table_name from information_schema.tables where table_rows = 0 and table_schema = 'usa'))
- END //
- DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement