Skip to Content
0

Table Function/Query error inside a “cross-database queries” scenario

Sep 19, 2017 at 09:40 AM

66

avatar image

Dear,

I’m asking your support for a problem regarding a Table Function inside a “cross-database queries” scenario.

This is our Hana landscape.

This is the table function created in the BI Tentant HBQ.

FUNCTION "BIDEV"."dwh.mes.mes_tf::TF_TURNI_FERMATE" (IP_YEAR INTEGER) 


       RETURNS TABLE ("HANDLE_ID" NVARCHAR(412), "SITE" NVARCHAR(6), "RESRCE" NVARCHAR(36), "DATE_TIME" NVARCHAR(20), "TURNO" NVARCHAR(15), "DATA_ORA_INIZIO" NVARCHAR(20), "DATA_ORA_FINE" NVARCHAR(20))


       LANGUAGE SQLSCRIPT


       SQL SECURITY INVOKER AS


BEGIN


RETURN


SELECT DISTINCT 


              RLS.HANDLE AS HANDLE_ID,


              RLS.SITE,


              RES.RESRCE,


              RLS.DATE_TIME_END AS DATE_TIME,


              CAL.TURNO,


              CAL.DATA_ORA_INIZIO,


              CAL.DATA_ORA_FINE


        FROM HMQ.WIPUSER.ZME_RESRCE_LOG_STATE RLS 


        LEFT OUTER JOIN HMQ.WIPUSER.RESRCE RES


              ON RLS.HANDLE = RES.HANDLE


        LEFT OUTER JOIN HMQ.WIPUSER.ZME_CYB_CALENDAR CAL


           ON CAL.SITE = RLS.SITE 


           AND CAL.ZMACCHINA = RES.RESRCE


           AND RLS.DATE_TIME_END > CAL.DATA_ORA_INIZIO AND  RLS.DATE_TIME_END <= CAL.DATA_ORA_FINE


        WHERE YEAR(RLS.DATE_TIME_END) = :IP_YEAR;


END;

I have used this Table Function inside a Calculation View always, into the BI Tenant HBQ.

If I try to get a preview data, this error appears.

The same Table Function, created directly in the MES Tentant HMQ, works well.

So, I tried to execute the core selection query of the table function directly into SQL Console, but the error persists.

By excecuting queries on single tables, all correctly work.

Below the structures of tables of the MES Tenant HMQ used by Table Function.

The environment of HANA is SPS 12 (1.00.122.08.1490178281)

Any suggestion?

Best regards,

Denis Peretto.

hte-landascape.png (44.9 kB)
1.png (37.2 kB)
2.png (284.3 kB)
2.png (20.9 kB)
3.png (23.5 kB)
4.png (27.8 kB)
5.png (24.4 kB)
11.png (197.4 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Utente Vimar Generico Utente Vimar Generico Dec 22, 2017 at 02:28 PM
0

Solved by SAP Support.

This is the response:

This query error is identified as known issue for accessing temporary index with cross database access environment. And the bug was fixed in reversion 122.09

[Workaround]
Add "WITH HINT (NO_CS_JOIN)" at the end of the problematic query/select statement. Please note, using this Workaround can Impact performance.

Share
10 |10000 characters needed characters left characters exceeded