Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

SAP HANA - Is there any option to materialize subquery results?

$
0
0

Hello HANA Experts,

 

Is there any option to materialize subquery results before executing outer query?

 

I wanted to make sure inner runs before outer query is executed. For Oracle ROWNUM >=1 condition in inner query forces it to materialize subquery results before executing the outer query.

 

I basically  want to make this query work

 

SELECT T0.FIELD1 F1, T0.FIELD2 F2, T0.FIELD3 F3, T0.FIELD4 F4

FROM (SELECT * FROM MY_SCEHAMA.GENERIC_TABLE WHERE OBJECT_ID = 10) TO WHERE T0.CODE = 12520 AND TO_DATE(FIELD2,'YYYY-MM-DD') >= TO_DATE('2014-11-27','YYYY-MM-DD') ;

 

FIELD2 is a VARCHAR field in GENERIC_TABLE which stores different types(Number, Decimal, Date, String etc) of data in string format. For a specific OBJECT_ID (in this case 10) it stores same type of data in string format (In this case Date).

 

Without inner query, the following query fails for TO_DATE conversion.

 

SELECT T0.FIELD1 F1, T0.FIELD2 F2, T0.FIELD3 F3, T0.FIELD4 F4

FROM MY_SCEHAMA.GENERIC_TABLE WHERE TO WHERE T0.CODE = 12520 AND TO_DATE(FIELD2,'YYYY-MM-DD') >= TO_DATE('2014-11-27','YYYY-MM-DD') AND T0.OBJECT_ID = 10;

 

So we wanted to make sure the OBJECT_ID restriction applied before other restrictions are applied. But the inner query execution is also not guaranteed by optimizer.

 

Is there any option to materialize inner query results before executing outer query in SAP HANA?

 

 

Thanks,

Suren.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>