0

I am using DB2 z/OS 11.1.5. According to this reference, OLAP functions such as first_value should be supported at least in DB2 9.7. However, when trying to execute the query

declare global temporary table T (reference integer, val integer) on commit preserve rows;
insert into session.T values(1, 10);
insert into session.T values(2, 20);
select first_value(val) over (order by reference) from session.T;

I am given the error

NO AUTHORIZED FIRST_VALUE NAMED HAVING COMPATIBLE ARGUMENTS WAS FOUND. SQLCODE=-440, SQLSTATE=42884, DRIVER=4.18.60. 2) [Error Code: -514, SQL State: 26501] THE CURSOR SQL_CURLH200C1 IS NOT IN A PREPARED STATE.. I am aware of the listing of error codes. However, these descriptions do not help me to understand the problem.

2

You are mixing up Db2 (Db2 for Linux, Unix and Windows) and Db2 for z/OS.

Db2 9.7 is LUW (Linux, Unix and Windows) and FIST_VALUE is available on these OS'es.

Db2 for z/OS does not support FIRST_VALUE.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.