2016-08-19 18 views
1

我試圖在SPUFI運行查詢爲:運行查詢時,爲什麼會收到錯誤-4700(嘗試使用新的函數模式)?

select * from (select * from emptable 
order by empno asc fetch first 10 rows only) as A 
order by empno desc fetch first 1 rows only; 

返回的錯誤是:

sqlcode = -4700, error: attempt to use new function before new function mode.

我運行z/OS的DB2版本9

+0

嗯,根據手冊-4700是「-4700 嘗試使用新功能之前,新功能模式」 。但是我無法找到任何關於您的查詢的特別信息,這些查詢在當前的DB2安裝中應該要求NFM。你正在運行什麼版本的DB2(在CM中)? –

+0

嗨Piet,我剛剛運行查詢 - 從SYSIBM.SYSDUMMY1選擇getvariable('SYSIBM.VERSION'),結果是DSN09010 ..所以我認爲它的版本9 – sleeper

回答

5

的問題是,你在子查詢中正在使用order byfetch first - 這是DB2 for z/OS版本9之前尚未存在的功能:

In prior versions of DB2 for z/OS, the ORDER BY and FETCH FIRST n ROWS ONLY clauses were supported only at the statement level as part of select-statement or a SELECT INTO statement. Version 9 delivers additional flexibility by allowing both FETCH FIRST n ROWS ONLY and ORDER BY clauses when they are specified as part of a subselect or a fullselect statement.

(DB2 V9.1 for z/OS - 新增功能? GC18-9856-12)

顯然,您的DB2安裝仍在兼容模式下運行,並且尚未切換到新功能模式,所以此功能尚不可用。

請注意,您的安裝有一個更嚴重的問題比CM < - > NFM因爲

Support for DB2 for z/OS Version 9 was discontinued on June 27, 2014.

相關問題