I'm new at HANA Studio, so please excuse me.
I am getting an error while creating function in SAP HANA Studio. Here's my function :
CREATE FUNCTION "PAYROLLDBTEST".GetAbsenteeismDays
(
-- Add the parameters for the function here
EmpID integer,
StartDate Datetime,
EndDate Datetime
)
RETURNS AbsDays float
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
AS
AbsDays float;
BEGIN
(SELECT SUM(DATEDIFF(DAY, "fromDate", "toDate") + 1) AS AbsentDays into AbsDays
FROM HEM1
WHERE "empID" = :EmpID AND "fromDate" BETWEEN :StartDate AND :EndDate
AND "toDate" BETWEEN :StartDate AND :EndDate
);
RETURNS AbsDays;
error :
"Could not execute 'CREATE FUNCTION "PAYROLLDBTEST".GetAbsenteeismDays ( -- Add the parameters for the function here ...' in 2 ms 807 µs . SAP DBTech JDBC: [257] (at 576): sql syntax error: incorrect syntax near "RETURNS": line 23 col 1 (at pos 576) "