互联网服务Db2数据库sysIBM

有没有db2 SYSIBM.SYSCOLUMNS相关资料

我想将下面oracle代码转换db2的代码下面是我转换的一部分。有没有相关资料可以查询,谢谢。

db2代码

[code class=""]SELECT t.NAME as column_name,t.COLTYPE as data_type,t.NULLS as nullable,null as
constraint_type,
t.LENGTH as data_length,null as data_precision,null as data_scale,t.REMARKS as COMMENTS
from SYSIBM.SYSCOLUMNS t where t.TBNAME='AREA' and t.TBCREATOR='PUB';
[/code]

oracle代码

[code class="lang-sql" lang="sql"]select column_name, data_type, nullable, sum(constraint_type) constraint_type, data_length, data_precision, data_scale,COMMENTS
from (
SELECT tc.column_name AS column_name, tc.data_type AS data_type, tc.nullable AS NULLABLE,
                                    decode(c.constraint_type, 'P', 1, 'R', 2, 'U', 4, 'C', 8, 16) AS constraint_type,
                                    data_length, data_precision, data_scale, column_id,D.COMMENTS
from all_tab_columns tc
    left outer join (
            all_cons_columns cc
            join all_constraints c on (
                c.owner=cc.owner
                and c.constraint_name = cc.constraint_name
            )
        ) on (
            tc.owner = cc.owner
            and tc.table_name = cc.table_name
            and tc.column_name = cc.column_name
        )
LEFT JOIN ALL_COL_COMMENTS D ON TC.OWNER=D.OWNER AND TC.TABLE_NAME=D.TABLE_NAME AND TC.COLUMN_NAME=D.COLUMN_NAME
    where tc.table_name = 'AREA' and tc.owner = 'PUB'   
order by tc.table_name, cc.position nulls last, tc.column_id)
group by column_name, data_type, nullable, data_length, data_precision, data_scale, column_id,COMMENTS
order by column_id
[/code]
参与9

1同行回答

y18511664518y18511664518技术总监长城超云
这个应该不难吧,SQL语法大致都是一样的,只是一些关键词、函数、字段属性每种数据库都有各自的特点。根据你们的业务改吧,如果是从oracle迁移到DB2上,改程序,这一块工程量还是很大的。还有一点,题文不符。...显示全部

这个应该不难吧,SQL语法大致都是一样的,只是一些关键词、函数、字段属性每种数据库都有各自的特点。根据你们的业务改吧,如果是从oracle迁移到DB2上,改程序,这一块工程量还是很大的。还有一点,题文不符。

收起
金融其它 · 2017-09-30

提问者

adnyz168
软件开发工程师iccs

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2017-07-01
  • 关注会员:2 人
  • 问题浏览:3340
  • 最近回答:2017-09-30
  • X社区推广