我試圖在sybase中定義一個函數。我寫這個劇本:如何在sybase中創建用戶定義的函數?
CREATE FUNCTION GetUserGroup (userId int)
RETURNS int
BEGIN
RETURN (10)
END
但是當我運行它,我得到這個錯誤:
>[Error] Script lines: 1-6 --------------------------
Incorrect syntax near the keyword 'BEGIN'.
Msg: 156, Level: 15, State: 2
Server: NEWSERVER, Procedure: GetUserGroup, Line: 3
>[Error] Script lines: 1-6 --------------------------
A RETURN statement with a return status may only be used in a SQL stored procedure.
Msg: 178, Level: 15, State: 1
Server: NEWSERVER, Procedure: GetUserGroup, Line: 4
[Executed: 10/13/09 11:01:29 AM IRST ] [Execution: 0/ms]
我能做些什麼? 謝謝
不會對ASE 12.x的 – 2015-02-26 12:28:44