oracle批量写create语句
- 2017-03-01 15:03:00
- 1147533288 原创
- 1422
1.案例sql来源真实项目,仅记录下。
select * from ird_main where parent_id='1';
create table t1 as
select main_id,wm_concat(field_code||' varchar2(1500)') ss from ird_table where is_index='1' group by main_id;
select 'create table '||a.main_code||'( '||b.ss||');' from ird_main a ,t1 b where a.main_id=b.main_id and a.parent_id='1';
2.上述sql查询出的结果都显示为CLOB无法粘贴,采用以下办法:
使用plsql command window
set heading off;
set log 40000;
select 'create table '||a.main_code||'( '||b.ss||');' from ird_main a ,t1 b where a.main_id=b.main_id and a.parent_id='1';
屏幕输出所有create语句,每行一个,分号结束;粘贴到数据库建表即可。
文章分类
联系我
| 联系人: | meepo |
|---|---|
| 电话: | ***** |
| Email: | 1147533288@qq.com |
| QQ: | 1147533288 |