Skip to Content
0

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

Dec 07, 2016 at 08:53 PM

317

avatar image
Former Member

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

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

2 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.

Share
10 |10000 characters needed characters left characters exceeded
Florian Pfeffer
Aug 01, 2017 at 07:54 PM
0

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 :-)

Share
10 |10000 characters needed characters left characters exceeded