从这个逻辑视图中创建一个PF?

时间:2013-08-23 12:51:53

标签: ibm-midrange db2-400

我有一个正常的逻辑视图但我无法在报表工具中显示数据,因为它的CCSID是HEX。如果我可以在AS / 400 DB2 i上创建PF,那么我就可以在CCSID上使用CHGPF(CHGLF没有。)

可以这样做吗?这是在IBM I DB2

这是代码:

CREATE VIEW astlib.acbalmpk AS (
   (SELECT  LMLTPC, COALESCE(IRLOC1,'') as IRLOC1,
    COALESCE(IRLOC2,'') as IRLOC2,
    COALESCE(IRLOC3,'') as IRLOC3,
    IRPRT#,
    IRQOH#,
    IRWHS#,
    '' as IEPRT#,
    '.00' as IEQOH#,
    '' as IELOC1,
    '' as IELOC2,
    '' as IELOC3,
    '' as IERIDC,
    '' as IEWHS#
FROM
   (SELECT LMLTPC, LMLOC1, LMLOC2, LMLOC3
    FROM ASTDTA.ICLOCMLM
    WHERE LMLTPC IN ('PAL', 'RAK'))t1
   LEFT OUTER JOIN
   (SELECT IRLOC1, IRLOC2, IRLOC3, IRPRT#, IRQOH#, IRWHS#
    FROM ASTDTA.ICBLDTIR) t2
   ON LMLOC1=IRLOC1 AND LMLOC2=IRLOC2 AND LMLOC3=IRLOC3)
UNION ALL
   (SELECT ' ' as LMLTPC,
    ' ' as IRLOC1,
    ' ' as IRLOC2,
    ' ' as IRLOC3,
    '' as IRPRT#,
    '.00' as IRQOH#,
    '' as IRWHS#,
    IEPRT#,
    IEQOH#,
    IELOC1,
    IELOC2,
    IELOC3,
    IERIDC,
    IEWHS#
 FROM ASTDTA.ICBALMIE)
)

1 个答案:

答案 0 :(得分:2)

修复作业的CCSID或 修复基础表的CCSID或 修复系统的CCSID或 配置ODBC驱动程序以转换CCSID 65535或 编写一个以适当的CCSID

返回数据的存储过程

对于此特定解决方法,请使用CAST使每列成为正确的CCSID。

SELECT cast (LMLTPC as char (30) CCSID 37) as LMLTPC...