Skip to Content
-1

How to create .hdbview??

Mar 03, 2017 at 02:54 PM

265

avatar image

i am trying to execute this code but it's throwing me the following two errors.

error **.PH.SD.OR:V_STK_TOP10_RTRN.hdbview
A SQL error occurred while creating a SQL view

error **.PH.SD.OR:V_STK_TOP10_RTRN.hdbview
A SQL error occurred while creating a SQL view

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Mar 03, 2017 at 05:21 PM
1

I think the group by statements might be the problem here. Just use the field names natl_grp_cd etc instead of the condition. If I were you, and the error messages are ambiguous, I would comment a few lines and keep checking and uncommenting until I am able to pin-down on the issue.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thanks Benedict! i tried uncommenting and executing few times still not able to point out the issue! can't I put the conditions under group by? if you have any example with group by that will be really helpful. Thanks again!

0
Former Member

I see the GROUP BY is outside of the first SELECT. Can you please try something like this,

query = "select \"CYM\", \"HOME_DC_ID\", \"NATL_GRP_CD\", \"RX_PURCH_AMT\" FROM

(SELECT cym AS \"CYM\"

,home_dc_id AS \"HOME_DC_ID\"

,IFNULL(LTRIM(natl_grp_cd),'UNASSIGNED') AS \"NATL_GRP_CD\"

,SUM(rx_purch_amt) AS \"RX_PURCH_AMT\"

FROM \"ST00\".\"V_STK_TOP10_RTRN_1\"

GROUP BY cym, natl_grp_cd)";

1

yes! I tried aliasing the columns under select and it's working fine! :) Thanks Benedict.

P.S: without aliasing the columns under group by it works fine.

0