Skip to Content
0

HANA data type is changing in SQL PROCEDURE

Jan 22, 2017 at 05:52 AM

88

avatar image
CREATE TYPE SAPABAP1.TT_TEST AS TABLE (  
MATERIAL NVARCHAR (000018),
ZSLAMT_GC DECIMAL (000017, 000002));
   CREATE PROCEDURE SAPABAP1.SP_TEST
   ( 
    IN I_VIEW SAPABAP1.TT_TEST,
    I_PERCENT  DECIMAL (000017, 000002) ,
    OUT E_VIEW  SAPABAP1.TT_TEST 
  	) 
  	LANGUAGE SQLSCRIPT READS SQL DATA AS
  BEGIN
  E_VIEW = SELECT  MATERIAL, AMOUNT * :i_PERCENT AS AMOUNT FROM :I_VIEW ;					
  END;

I am getting this warning

java.sql.SQLWarning: general warning: general warning: Type mismatch for table variable E_VIEW:Declared type "DECIMAL(17,2)"  of attribute "AMOUNT" not same as assigned type "DECIMAL(35,4)" :line 12 col 3 (at pos 270) 

How do I fix this type mismatch ?

PS : searching older SCN posts are so difficult and also to post questions

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

1 Answer

Rajarshi Muhuri Jan 22, 2017 at 05:59 AM
0
TO_DECIMAL(AMOUNT * :i_PERCENT, 17,2) AS AMOUNT

PS: I found that I can cast to decimal , but wondering that is there any other alternate way , as casting to decimal will slow down my query

Share
10 |10000 characters needed characters left characters exceeded