Skip to Content
2
Jul 03, 2020 at 07:45 AM

SQL "inline declaration must have alias" error for substring

3317 Views

I wrote a SQL like below..

SELECT substring( cosp_bak~objnr,7,10 ),
        cosp_bak~kstar,
        cosp_bak~wkg001,cosp_bak~wkg002,cosp_bak~wkg003,cosp_bak~wkg004,cosp_bak~wkg005,cosp_bak~wkg006,cosp_bak~wkg007,cosp_bak~wkg008,cosp_bak~wkg009,
        cosp_bak~wkg010,cosp_bak~wkg011,cosp_bak~wkg012
        FROM cosp_bak
        WHERE
        cosp_bak~wrttp = '01'
        and cosp_bak~vrgng = 'RKP1'
        AND cosp_bak~gjahr = @s_gjahr
        AND cosp_bak~objnr in @t_objnr 
        INTO TABLE @DATA(gt_data_p).

And it has error below. It looks like the error is caused by the substring function. then How to add alias name for it? Thanks.

inline declarations are used, all expressions in the projection list must have an alias name.