Skip to Content
0
Jan 27, 2021 at 08:09 PM

Dynamic SQL returns strange error if ORDER BY is missing

124 Views

Dear community,

I built this dynamic SQL to handle selection based on parameters passed to a REST services (e.g. $sort, $filter):

SELECT (iv_column_syntax) FROM (iv_source)
WHERE (iv_cond_syntax)
ORDER BY (lv_orderby)
INTO CORRESPONDING FIELDS OF TABLE @et_entityset
UP TO @lv_top ROWS
OFFSET @lv_skip.

I noticed that deleting the ORDER BY clause in bold triggers a compile error:

Couldn't find Error Message: E SELECT 605 because the system is running
with the database objects from release 740. The system has not
completely upgraded to release 749.

Same happens if lv_orderby is present, but empty. It does work when it is set to 'PRIMARY KEY', for instance.

On the other hand, old syntax SQL works. But I can't use OFFSET, as it available only in the new syntax.

SELECT (iv_column_syntax) FROM (iv_source)
UP TO lv_top ROWS
"OFFSET lv_skip
INTO CORRESPONDING FIELDS OF TABLE et_entityset
WHERE (iv_cond_syntax)
ORDER BY (lv_orderby).

Is this really due to an update currently running?