![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
ALTER FUNCTION "DBA"."pf_GetGrpIdFromAcctnoNnickname"(acctNo varchar, acctGrpId integer/* [IN] parameter_name parameter_type [DEFAULT default_value], ... */ ) RETURNS INTEGER DETERMINISTIC BEGIN // using watcom sql syntax DECLARE "acct_grp_ID" INTEGER; set "acct_grp_ID" = -1; select acct_grp_ID into "acct_grp_ID" from account where acct_no = acctNo and acct_grp_id = acctGrpId; if @@count = 1 then RETURN "acct_grp_ID"; if @@count <= 0 then RETURN -1; set "acct_grp_ID" = 0 - @@count; RETURN "acct_grp_ID"; END // <--- sybase central complained Syntax error near '(end of line)' on line 15 [Sybase][ODBC Driver][SQL Anywhere]Syntax error near '(end of line)' on line 15 SQLCODE: -131 SQLSTATE: 42000 |
#2
| |||
| |||
|
|
You are mixing T-SQL with Watcom. IF .. THEN .. - is T-SQL syntax use IF .. THEN ... END IF; - as per Mark's suggestion. Additionally, looks like you also need to fix '@@count' , which is not declared. You problably meant to use global variable @@ROWCOUNT e.g. IF @@ROWCOUNT = 1 THEN RETURN .... END IF; Lucjan "gg" <gg (AT) nowhere (DOT) ca> wrote ALTER FUNCTION "DBA"."pf_GetGrpIdFromAcctnoNnickname"(acctNo varchar, acctGrpId integer/* [IN] parameter_name parameter_type [DEFAULT default_value], ... */ ) RETURNS INTEGER DETERMINISTIC BEGIN // using watcom sql syntax DECLARE "acct_grp_ID" INTEGER; set "acct_grp_ID" = -1; select acct_grp_ID into "acct_grp_ID" from account where acct_no = acctNo and acct_grp_id = acctGrpId; if @@count = 1 then RETURN "acct_grp_ID"; if @@count <= 0 then RETURN -1; set "acct_grp_ID" = 0 - @@count; RETURN "acct_grp_ID"; END // <--- sybase central complained Syntax error near '(end of line)' on line 15 [Sybase][ODBC Driver][SQL Anywhere]Syntax error near '(end of line)' on line 15 SQLCODE: -131 SQLSTATE: 42000 |
![]() |
| Thread Tools | |
| Display Modes | |
| |