cancel
Showing results for 
Search instead for 
Did you mean: 

error in simple produre

Former Member
0 Kudos

Hi,

could anybody please let me know what is the issue with this procedure. Its giving me error at line 4 as it is not recognizing VAR1 input parameter.

CREATE PROCEDURE MULTI1 (IN VAR1 INTEGER, IN VAR2 INTEGER, OUT VAR3 INTEGER)

LANGUAGE SQLSCRIPT SQL SECURITY INVOKER AS

BEGIN

B = :VAR1 * :VAR2;

END;

Rgds

Accepted Solutions (0)

Answers (1)

Answers (1)

muthuram_shanmugavel2
Contributor
0 Kudos

Hi,

Small Mistake in the code.

You have defined VAR3 as Output

But In formula, you mentioned that (B = :VAR1 * :VAR2)

So you are getting error that

SAP DBTech JDBC: [1287]: identifier must be declared: B: line 4 col 1 (at pos 129)

I changed the formula to VAR3 = :VAR1 * :VAR2.

It is working fine.

CREATE PROCEDURE MULTI1 (IN VAR1 INTEGER, IN VAR2 INTEGER, OUT VAR3 INTEGER)

LANGUAGE SQLSCRIPT SQL SECURITY INVOKER AS

BEGIN

VAR3 = :VAR1 * :VAR2;

END;


---------------------------------------------------------------------------


Call "INF713775"."MULTI1" (3, 2, ?)


Returns Output as 6.

Regards,

Muthuram

Former Member
0 Kudos

hello Muthuram,

Initially i kept it like that only but got that error. its still giving me error even though im putting it as:

CREATE PROCEDURE MULTI1 (IN VAR1 INTEGER, IN VAR2 INTEGER, OUT VAR3 INTEGER)

LANGUAGE SQLSCRIPT SQL SECURITY INVOKER AS

BEGIN

DECLARE B INT;

VAR3 = :VAR1 * :VAR2.

END;

Error is:

SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near ":VAR1": line 5 col 8 (at pos 153)

rgds

muthuram_shanmugavel2
Contributor
0 Kudos

Again Minor mistakes.

1. Remove Declare B INT Line as you have not used anywhere.

2. In VAR3 Formula, At the End of line you have to use semicolon but you used fullstop .

Use the procedure I have given in previous reply, It should work.

Please go through this link for procedure syntax.

CREATE PROCEDURE - SAP HANA SQL and System Views Reference - SAP Library

Regards,

Muthuram

Former Member
0 Kudos

sorry for confusion as it was just typo. im now using this and still getting same error:

CREATE PROCEDURE MULTI1 (IN VAR1 INTEGER, IN VAR2 INTEGER, OUT VAR3 INTEGER)

LANGUAGE SQLSCRIPT SQL SECURITY INVOKER AS

BEGIN

VAR3 = :VAR1 * :VAR2;

END;

muthuram_shanmugavel2
Contributor
0 Kudos

Hi,

This is correct code only.

It should work.

Share me the error with screenshot, So i can check.

Former Member
0 Kudos

please find screen shot

muthuram_shanmugavel2
Contributor
0 Kudos

The same query executed successfully in my system and procedure has been created.

What is your HANA Version?

Please Open new Sql Editor Session and try to execute the SQL

chandan_praharaj
Contributor
0 Kudos

Check my code, I have replicated your issue. its working fine in my system.