我想将下面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]