我正在尝试使用HANA存储过程创建视图,但无法做到。 它会在“。”附近给出错误的语法错误。
我想通过使用HANA存储过程创建视图,但无法做到。
它在“。”附近给出错误的语法错误。
在
调用“PAYROLLDBTEST”.GetEmpCodeFromEmployeeID(EmpID,EmpCode)AS“EmpCode”
这是我的代码:
CREATE VIEW "@HourTransactionView" AS SELECT "@TRANSACTION_HOURS"."DocEntry","@TRANSACTION_HOURS"."DocNum",
"@TRANSACTION_HOURS"."U_EmpCode" AS "EmpID",
call "PAYROLLDBTEST".GetEmpCodeFromEmployeeID(EmpID,EmpCode) AS "EmpCode" ,
GetEmployeeFullName("@TRANSACTION_HOURS"."U_EmpCode") AS "FullName", "U_TransactionType" AS "TranCode",
GetHourTableName("U_TransactionType") AS "TableName", GetHourTransactionName("U_TransactionType") AS "TranName",
"U_FromDate", "U_ToDate", DAYS_BETWEEN("U_FromDate", "U_ToDate") + 1 AS "NoOfDays", "U_FromTime", "U_ToTime",
IFNULL("U_WorkHours", 0) AS "NoOfHours", IFNULL("U_OvertimeHours", 0) AS "OvertimeHours",
IFNULL("U_PaidDays", 0) AS "PaidDays", IFNULL("U_UnpaidDays", 0) AS "UnpaidDays",
IFNULL("U_WeekendsCount", 0) AS "Weekends", IFNULL("U_HolidaysCount", 0) AS "Holidays", "U_Remarks", "U_BatchNo",
"U_ProjectCode" AS "ProjectCode"
FROM "@TRANSACTION_HOURS"
INNER JOIN OHEM ON OHEM."empID" = "@TRANSACTION_HOURS"."U_EmpCode";
请帮我找到解决方案。 谢谢。
答案 0 :(得分:1)
参考Hana SQL引用,您不能在select语句中使用过程调用。
http://help.sap.com/saphelp_hanaplatform/helpdata/en/20/fcf24075191014a89e9dc7b8408b26/content.htm
答案 1 :(得分:0)
也许你可以尝试将程序“PAYROLLDBTEST”.GetEmpCodeFromEmployeeID包装成一个函数。这可以使用procview来完成。
CREATE PROCEDURE GetEmpCodeFromEmployeeID(...)
LANGUAGE SQLSCRIPT
READS SQL DATA WITH RESULT VIEW ProcView AS
BEGIN
...
END;
Create Function GetEmpCodeFromEmployeeIDFunc(...)
Begin
return Select * from ProcView;
End;
参考:https://help.sap.com/saphelp_hanaplatform/helpdata/en/20/d467407519101484f190f545d54b24/content.htm