Skip to Content
avatar image
Former Member

SAP HANA Studio Syntax error. ";" is incorrect or misplaced. UNION

Hi forum,

if I use this piece in a stored procedurem where I want to fill a table variable with a UNION, I get this error message

Syntax error. ";" is incorrect or misplaced.

Code:

PROCEDURE myproc

( in it_in table (var int), OUT et_out table (var int) )

LANGUAGE SQLSCRIPT

SQL SECURITY INVOKER

READS SQL DATA AS

BEGIN

et_out = select '' as noteid from dummy

UNION

select '' as noteid from dummy;

END

I can active the procedure, but the error is somehow strange. When creating the procedure in the SQL editor, I dont get any errors.

Regards

Volker Jordan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Aug 01, 2017 at 06:28 PM
    -1

    Hey man, Why are you not closing the quotation for et_out and select. Try this and this should work. Thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • 4 days ago
    -1

    Hello

    May i know did you resolve this issue..? I'm having same issue.. Appreciate your quick reply.

    Thanks,

    Pradeep

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 01, 2017 at 07:54 PM

    Hm, I cannot figure out why you get the ";" is incorred or misplaced error.

    But there are several issues in your procedure which should be corrected:

    • Your ET_OUT parameter is a table with one column called "VAR", but the SELECT uses "NOTEID" as column name. You have to use the same names, so that the result can be added to the out parameter.
    • Your ET_OUT parameter column "VAR" has type INT, but you select '' (an empty string) in your UNION select statements. This will result in an invalid number error. If you wanna return an INT value than you should select INT values.
    • Place an ";" after the END statement of your procedure.

    Regards,
    Florian

    PS: I just looked on the technical issues. If your procedure makes sense or not in the current form from a business point of view is your decision :-)

    Add comment
    10|10000 characters needed characters exceeded