cancel
Showing results for 
Search instead for 
Did you mean: 

Faced a syntax error when running a procedure with variables

former_member585658
Participant
0 Kudos

Hello Colleagues,

I faced here a issue, after a long time of Brushing up my coding skills and looks ugly .

PROCEDURE "HeatSensorWserv"(
SensorID NVARCHAR(250),
Event_Timestamp Timestamp,
RecordedHeat Decimal(6,2),
Current_ERecording DECIMAL(6,2),
Status NVARCHAR(250) )
   LANGUAGE SQLSCRIPT
   SQL SECURITY INVOKER
   AS
BEGIN
DECLARE Maximum_Heat_Previously_recorded DECIMAL(6,2);
DECLARE Minimum_Heat_previously_recorded DECIMAL(6,2);
   /*************************************
       Write your procedure logic 
   *************************************/
   select max(RecordedHeat) from "IND_IOT_PRJ.DBMODULE::CLIMRK.HeatSensorModuleMonitor" into  :Maximum_Heat_Previously_recorded;
   select min(RecordedHeat) from "IND_IOT_PRJ.DBMODULE::CLIMRK.HeatSensorModuleMonitor" into :Minimum_Heat_previously_recorded;
   insert into "IND_IOT_PRJ.DBMODULE::CLIMRK.HeatSensorModuleMonitor" values
   (:SensorID,:Event_Timestamp,:Minimum_Heat_previously_recorded,:Maximum_Heat_Previously_recorded,:RecordedHeat,:Current_ERecording,:Status);
END
RecordedHeat is a table column

Please help me here,where i am getting it wrong!!

Syntax error: "incorrect syntax near ":Maximum_Heat_Previously_recorded"" [8250009]

at "src/procedure/HeatSensorWserv.hdbprocedure" (1

Last question ? is it possible to pass blob files inside procedure ? i am using a post to post information into procedures that write in to HANA Tables.

Br,
Gabriel.

Accepted Solutions (1)

Accepted Solutions (1)

SergioG_TX
Active Contributor

i can suggest a few things here:

1) the column names will be capitalized if they are not wrapped with double quotes. if you want case sensitive column name, then wrap them in "COL_NAME"

2) blobs are not allowed to be passed between procs - at least not on or before SP12 -- i have attempted that before but did not work for me

3) the error you have here related to incorrect syntax near your column.... I do not see an issue, except for.... if you exclude the column names in the insert statement, sometimes the column names are not on the same order as they appear in a table. this usually happens when the table is altered or its structure changes. See if specifying the column names in the same order they will show in your values ( ) clause solves your issue. Also, make sure the table name is specified correctly - the max(RecordHeat) -- you need to specify the column name instead of the table name

Answers (1)

Answers (1)

ssurampally
Active Contributor

Can you try INTO clause, before FROM clause as shown below.

select max(RecordedHeat) into :Maximum_Heat_Previously_recorded from "IND_IOT_PRJ.DBMODULE::CLIMRK.HeatSensorModuleMonitor";