× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This seems to be my day for problems with SQL.
Given the statement:
sELECT GL_SEQ, row_number () over (partition by gl_seq order by
dbglt_company,gl_seq) Line,vaigjglno,
DBGLT_DATE,((DBGLT_FISCAL_YEAR * 100) + DBGLT_ACCT_PERIOD) Period,
DBGLT_BASE_AMOUNT, case when DBGLT_BASE_AMOUNT < 0 then 'C' else
'D' end DRCR FROM dbglglt join control_xref
on DBGLT_FISCAL_YEAR = GL_Year and DBGLT_ACCT_PERIOD = GL_PERIOD
AND DBGLT_CONTROL_GROUP = GL_group and DBGLT_SOURCE_CODE = GL_CODE
join VGLLMSTXRF on DBGLT_COMPANY = pglcmpny and DBGLT_ACCT_UNIT =
pglaccunt and DBGLT_ACCOUNT = pglaccnt and DBGLT_SUB_ACCOUNT =
pglsbaccn JOIN BATCH_XREF ON DBGLT_FISCAL_YEAR = BT_YEAR AND
DBGLT_ACCT_PERIOD = BT_PERIOD WHERE DBGLT_COMPANY = 101 AND
DBGLT_fiscal_YEAR > 2006 ORDER BY DBGLT_FISCAL_YEAR,
DBGLT_ACCT_PERIOD, DBGLT_CONTROL_GROUP, DBGLT_SOURCE_CODE

I get the following error on the CASE statement.
Message ID . . . . . . : SQL0171


Message . . . . : Argument 2 of function *N not valid.

Cause . . . . . : The data type, length, or value of argument 2 of function
*N specified is not valid.

When I take out the row_number () over (partition by gl_seq order by
dbglt_company,gl_seq) Line, it works fine.
I also works fine if I remove the CASE statement.

What am I doing wrong?

Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3




As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.