代码实例
select c.table_name, case when c.column_id=c.COLUMN_ID_MIN then 'create external table '||u.USERNAME||'_'||c.table_name||' ( ' else ',' end ||c.sqltxt|| case when c.column_id=c.COLUMN_ID_MAX then ') row format DELIMITED FIELDS terminated by ''01'' stored as textfile location ''ZZZZZZZ/' || c.table_name || ''';' else '' end , c.column_id, c.COLUMN_ID_MIN, c.COLUMN_ID_MAXfrom ( select table_name, column_name || ' ' || case data_type when 'NUMBER' then ' decimal(' || data_length || ',' || nvl(data_scale,0) || ') ' when 'FLOAT' then ' decimal(' || data_length || ',' || nvl(data_scale,0) || ') ' when 'VARCHAR2' then ' string ' when 'DATE' then ' string ' when 'INTEGER' then ' decimal(38,0)' when 'CHAR' then ' string ' end sqlTxt ,COLUMN_ID ,min(COLUMN_ID)over(partition by table_name) as COLUMN_ID_MIN ,max(COLUMN_ID)over(partition by table_name) as COLUMN_ID_MAX from user_tab_columns --where table_name='EMP' --order by COLUMN_ID asc )c left join user_users u on 1=1 order by c.table_name,c.COLUMN_ID asc 继续阅读与本文标签相同的文章
上一篇 :
每月一生信流程之RNAseq123
下一篇 :
mysql刷原生建表语句
-
IDC:SD-WAN基础设施市场将在2022年达到45亿美元
2026-05-25栏目: 教程
-
阿里云助力新加坡“智慧国计划”,生态建设发力巩固亚太第一
2026-05-25栏目: 教程
-
vscode统一代码风格
2026-05-25栏目: 教程
-
小程序wxml使用外部函数
2026-05-25栏目: 教程
-
微信小程序运行机制
2026-05-25栏目: 教程
