dbTalk Databases Forums  

Re: sa 11 function what is wrong this watcom syntax

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Re: sa 11 function what is wrong this watcom syntax in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Lucjan Chmura [Sybase iAnywhere]
 
Posts: n/a

Default Re: sa 11 function what is wrong this watcom syntax - 11-16-2009 , 08:34 AM






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

Quote:
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


Reply With Quote
  #2  
Old   
gg
 
Posts: n/a

Default Re: sa 11 function what is wrong this watcom syntax - 12-05-2009 , 11:04 AM






thx all very much. Looks like I 'd be better off sticking one dialect

In this scenario, better off with T-Sql
"Lucjan Chmura [Sybase iAnywhere]" <lchmura_at_sybase_dot_com> wrote in
message news:4b0162e3$1 (AT) forums-1-dub (DOT) ..
Quote:
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




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.