Quantcast
Channel: SCN : Unanswered Discussions - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 4343

Trying to create a function getting error - invalid name of function or procedure: DATE :

$
0
0

Hi,

I am trying to convert a function which was in SQL to HANA, here the function

 

 

CREATE FUNCTION "PAYROLLDBTEST".GetEmployeeWorkingDays

(

  -- Add the parameters for the function here

  EmpID int,

  Date datetime

)

RETURNS TABLE("WorkingDaysInMonth" float)

LANGUAGE SQLSCRIPT  

SQL SECURITY INVOKER

AS

BEGIN

  -- Declare the return variable here

  DECLARE WorkingDaysInMonth float;

  DECLARE EmploymentType nvarchar(50);

  DECLARE CalculationType int;

 

 

  -- Add the T-SQL statements to compute the return value here

  SELECT "U_EmpTypeID" AS "EmploymentType" FROM OHEM WHERE "empID" = :EmpID;

 

  SELECT "U_CalculationType" AS "CalculationType" FROM "@EMPLOYMENT_TYPES" WHERE "Code" = :EmploymentType;

 

  if (:CalculationType = 1) -- As per calendar

  THEN

  WorkingDaysInMonth := DATE("PAYROLLDBTEST".B1CFLMonthEnd(:Date));

  END IF;

 

  if (:CalculationType = 2) -- Custom days

  THEN

  SELECT "U_CustomDays" AS "WorkingDaysInMonth" FROM "@EMPLOYMENT_TYPES" WHERE "Code" = :EmploymentType;

  END IF;

 

  if (:WorkingDaysInMonth = 0 OR :WorkingDaysInMonth is null)

  THEN

  WorkingDaysInMonth := DAY(dbo.B1CFLMonthEnd(:Date));

  END IF;

  -- Return the result of the function

 

  RETURN WorkingDaysInMonth;

 

 

END;

 

 

Giving error "invalid name of function or procedure: DATE"

Could you please tell whats wrong.

 

Thanks


Viewing all articles
Browse latest Browse all 4343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>