SET CURRENT SCHEMA = "DECOSC";
SET CURRENT PATH = "SYSIBM","SYSFUN","SYSPROC","SYSIBMADM","DECOSC";
CREATE FUNCTION "GETCOLUMN"
(TABNAME VARCHAR(100))
RETURNS VARCHAR(100)
LANGUAGE SQL
SPECIFIC SQL151231114950200
BEGIN
DECLARE COLNAME VARCHAR(4096) DEFAULT '';--
FOR S AS SELECT COL_NAME_EN FROM OSC_COLUMN_INFO WHERE TAB_NAME_EN=TABNAME ORDER BY ID
DO
SET COLNAME=COLNAME||S.COL_NAME_EN||',';--
END FOR;--
RETURN SUBSTR(COLNAME,1,LENGTH(COLNAME)-1);--
END;
这样的函数,我具体应该是在图形对话框(老是出错),执行呢?还是再linux下执行(db2 -td@ -vf script.db2这样的命令,不懂,好像不对吧)