Created
November 4, 2019 12:56
-
-
Save BrunoGiubilei/dde881a8f0262de8d4618b68769e5f44 to your computer and use it in GitHub Desktop.
Transforma SQL em variáveis JAVA
This file contains 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
SELECT 'private '||( | |
CASE | |
WHEN data_type = 'integer' or data_type = 'bigint' THEN 'int' | |
WHEN data_type = 'timestamp with time zone' or data_type = 'timestamp without time zone' or data_type = 'time without time zone' | |
or data_type = 'character varying' or data_type = 'character' or data_type = 'char' or data_type = 'date' or data_type = 'text' THEN 'String' | |
WHEN data_type = 'double precision' or data_type = 'numeric' THEN 'double' | |
ELSE data_type END)||' '||column_name||';' | |
FROM information_schema.columns WHERE | |
table_name = 'nome_da_tabela'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment