Skip to main content

if I run first part then run SELECT ANALYZE_STATISTICS ('BSEG'); it is ok. But if I run complete code it throws exception says 'Execution error: ERROR: Unsupported use of LIMIT/OFFSET clause' what is going on ?

 

it all started when I tried to add field Koart to bseg. I reverted but still gets error for a few days.

 

First part :

 

DROP VIEW IF EXISTS "BSEG_UNION";

 

--Start of customization section

 

--If you extract new records though Replication Cockpit, leave this CREATE VIEW BSEG_UNION statement and delete/comment out the second one.

 

CREATE VIEW "BSEG_UNION" AS (

SELECT * FROM "BSID"

UNION ALL

SELECT * FROM "BSAD"

);

 

--If you extract new records through Data Jobs, leave this CREATE VIEW BSEG_UNION statement and delete/comment out the first one.

/*

CREATE VIEW "BSEG_UNION" AS (

SELECT

MANDT,BUKRS,KUNNR,UMSKS,UMSKZ,AUGDT, AUGBL,ZUONR,GJAHR,BELNR,BUZEI, BUDAT,CPUDT,BSCHL,SHKZG,DMBTR,WRBTR,SGTXT,ZFBDT,ZTERM,ZBD1T,ZBD2T,ZBD3T,ZBD1P,ZBD2P,SKFBT,SKNTO,WSKTO,REBZG,REBZJ,REBZZ,MANSP,MSCHL,MANST,REBZT,AUGGJ,NULL AS AUGCP,_CELONIS_CHANGE_DATE

FROM "BSID"

 

UNION ALL

 

SELECT

MANDT,BUKRS,KUNNR,UMSKS,UMSKZ,AUGDT,AUGBL,ZUONR,GJAHR,BELNR,BUZEI, NULL AS BUDAT,NULL AS CPUDT,BSCHL,SHKZG,DMBTR,WRBTR,SGTXT,ZFBDT,ZTERM,ZBD1T,ZBD2T,ZBD3T,ZBD1P,ZBD2P,SKFBT,SKNTO,WSKTO,REBZG,REBZJ,REBZZ,MANSP,MSCHL,MANST,REBZT,AUGGJ,AUGCP,_CELONIS_CHANGE_DATE

 FROM "BSEG_CL"

);

*/

 

--End of customization section

 

 

--THIS SECTION IS COMMON FOR RC AND NON-RC SETUP

DROP TABLE IF EXISTS "BSEG" ;

 

 

CREATE TABLE "BSEG" AS(

SELECT

    ROW_NUMBER()

        OVER(PARTITION BY "BSEG"."MANDT", "BSEG"."BUKRS", "BSEG"."BELNR", "BSEG"."GJAHR", "BSEG"."BUZEI"

            ORDER BY "BSEG"."AUGBL","BSEG"."MANDT", "BSEG"."BUKRS", "BSEG"."BELNR", "BSEG"."GJAHR", "BSEG"."BUZEI" ) AS NUM

    ,"BSEG".*

FROM

    "BSEG_UNION" AS BSEG

);

 

DELETE FROM "BSEG" WHERE NUM > 1;

ALTER TABLE "BSEG" DROP COLUMN NUM CASCADE;

 

DROP VIEW IF EXISTS "BSEG_UNION";

Hi @ömer.petek,

 

It is good to now that the part you are describing is not in PQL, but in Vertica SQL (PQL is what you use after creating a data/knowledge model and has process syntax incorporated). Checking the Vertica Forum with this issue, led me to this thread: Cannot use meta function or non-deterministic function — Vertica Forum. They propose a workaround, but that looks quite intensive having the various grouping columns in mind in your code.

Next to that, they show a nice trick how to make the query easier, so that you do not have to delete the duplicate rows afterwards.

 

Hope this helps.

 

Kind regards,

Jan-peter


Hi @ömer.petek,

 

It is good to now that the part you are describing is not in PQL, but in Vertica SQL (PQL is what you use after creating a data/knowledge model and has process syntax incorporated). Checking the Vertica Forum with this issue, led me to this thread: Cannot use meta function or non-deterministic function — Vertica Forum. They propose a workaround, but that looks quite intensive having the various grouping columns in mind in your code.

Next to that, they show a nice trick how to make the query easier, so that you do not have to delete the duplicate rows afterwards.

 

Hope this helps.

 

Kind regards,

Jan-peter

Hello Peter, thanks for your answer !

First of all I was not sure if I should call all the codes in Celonis as PQL or just dashboard creating part. Now it is clear, thanks for warning (:

 

Secondly, thanks for the link. it has so many good info. But not only want to fix this SQL ( it is Accounts receivable standard connector code by the way.) but also I want to learn what is going on. Because it was working and now it is not. there are some terms I should learn that are new to me like 'Projection', LIMIT etc.

 

I think this limit thing is about over partition part but not sure why these 2 codes are working one by one but not together :S

 

at first ALTER statement was also getting error and got fix by its own after a day. I am still hoping to get normal this one too (:


Hello Peter, thanks for your answer !

First of all I was not sure if I should call all the codes in Celonis as PQL or just dashboard creating part. Now it is clear, thanks for warning (:

 

Secondly, thanks for the link. it has so many good info. But not only want to fix this SQL ( it is Accounts receivable standard connector code by the way.) but also I want to learn what is going on. Because it was working and now it is not. there are some terms I should learn that are new to me like 'Projection', LIMIT etc.

 

I think this limit thing is about over partition part but not sure why these 2 codes are working one by one but not together :S

 

at first ALTER statement was also getting error and got fix by its own after a day. I am still hoping to get normal this one too (:

Hi @ömer.petek,

 

No worries, it helps a lot if you are digging in the user manuals to find some solutions :)

 

I didn't check the issue in detail, but since they are casting some characters it could be that you have some newly added data to your data lake that cannot be processed well, such as different character sets or invalid characters. Which characters these could be and where they are, I do not have a clue.

 

Kind regards,

Jan-peter


to everyone who will read here later:

 

The trick @janpeter.van.d wrote about to get actual data without delete duplicates is like this :

 

explain select * from (SELECT *,

ROW_NUMBER() OVER ( PARTITION BY REGEXP_REPLACE(LOWER(TRIM(col1)), '3^a-z0-9 ]', '') || ' ' ||

REGEXP_REPLACE(LOWER(TRIM(col2)), '3^a-z0-9 ]', '')||col3 ORDER BY col4 DESC) AS rank

FROM (

select 'abcd' col1, 'werweww23' col2, 'wewiej2938u23' col3, 23 col4 from dual

union

select 'wv45' col1, 'erteb' col2, '7897ghj' col3, 2 col4 from dual

union

select 'abcd' col1, 'werweww23' col2, 'wewiej2938u23' col3, 23 col4 from dual

) abc

) A WHERE rank = 1;

 

I hope it helps to anyone.


Reply