on 06-17-2014 12:35 PM
CREATE PROCEDURE "PAYROLLDBTEST".GetWorkingHoursAsFloat
(
-- Add the parameters for the function here
IN WorkingHours nvarchar(10),
OUT FloatValue float
)
--RETURNS float
LANGUAGE SQLSCRIPT
AS
BEGIN
-- Declare the return variable here
--DECLARE FloatValue float;
-- Add the T-SQL statements to compute the return value here
FloatValue := (SUM(case when (:WorkingHours <> '0')
then
IFNULL(SUBSTRING(:WorkingHours,0, IFNULL(LOCATE(':',:WorkingHours), LENGTH(:WorkingHours))),NULL)
else 0
end
) * 60)
+
SUM(CAST(IFNULL(SUBSTRING(:WorkingHours, LOCATE(':',:WorkingHours) + 1, LENGTH(:WorkingHours)),NULL) AS INTEGER))
;
IF(:FloatValue /60.0 IS NULL)
THEN
FloatValue := 0;
END IF;
END;
Which database system is this for (you've posted in the general "Databases" area)?
If you were writing this code for ASE, leaving aside other syntax differences, I would say the problem is that you did not have a SELECT keyword in front of the variable assignement
i.e.
SELECT FloatValue := (SUM(case when (:WorkingHours <> '0') [...]
-bret
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using HANA database.
When i executed above code with SELECT it gives syntax error like :
Could not execute 'CREATE PROCEDURE "PAYROLLDBTEST".GetWorkingHoursAsFloat ( -- Add the parameters for the function ...' in 1 ms 812 µs .
SAP DBTech JDBC: [257] (at 351): sql syntax error: incorrect syntax near ":=": line 15 col 19 (at pos 351) .
and when i do not use SELECT it gives error :
feature not supported:expr_agg.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.