I have the following HANA Procedure:
CREATE PROCEDURE SP_LIT()
AS
BEGIN
DECLARE count INT;
DECLARE pos INT;
DECLARE value NVARCHAR(100);
value := 'R,A';
IF LENGTH(:value) > 0 THEN
value := :value + ',';
pos := LOCATE(:value,',',1);
END IF;
WHILE :pos > 0 DO
BEGIN
INSERT INTO [O/P table] VALUES (LEFT(:value,:pos-1));
value := RIGHT(:value, LENGTH (:value)-:pos);
pos := LOCATE(:value,',',1);
END;
END WHILE;
END;
Everything seems fine but on execution the following error is thrown:
Error: invalid number exception: invalid number: not a valid number string 'R,A'
Any idea where am I going wrong?
I found the solution. The '+' sign in concatenation should be replaced by '||' pipe operator.