Skip to Content
Jul 16, 2013 at 11:07 AM

row_number with out order by in hana



I have a calculation view which exports my products in a specific order. I want to retain the order of products. But when i expose it as a OData service , the products are sorted by product key. While it is built in feature / Bug of OData that it sorts the records by key if no order by is mentioned , i want to add an extra column in my view to retain the order . For that , I thought of storing the row number for each row. I dont have any columns which i have to mention iin order by clause. I could not use row_number function without order by clause in hana. When i write below statement,


PRERULE, POSTRULE , row_number() over(order by (SELECT 1)) as rownum from "PAL"."AP_RULES_P" WHERE "PRERULE" = '73'

I got an error saying

incorrect syntax near ")": line 1 col 66 (at pos 66)

Can some one help me how to fix the situation?

Cant we use row_number with out order by in hana?

Deepthi lakshmi.A