Created
June 13, 2019 22:49
-
-
Save jrwarwick/32147fae1bd64655c4923f570c629464 to your computer and use it in GitHub Desktop.
Generate Oracle QuickSQL from all visible tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Quick, dirty, and incomplete. Look to dgielis/model_to_quicksql.sql for more power | |
select table_name||chr(10)||listagg(' '||column_name||' ' | |
||case data_type | |
when 'VARCHAR2' then 'vc'||to_char(data_length) | |
when 'NUMBER' then 'num' | |
when 'INTEGER' then 'int' | |
when 'DATE' then 'date' | |
when 'INTEGER' then 'int' | |
END,chr(10)) within group (order by column_id) quicksql | |
from all_tab_cols | |
where owner like '%' -- Probably should specify at least one schema here! | |
group by table_name | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment