Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

expressions resolved before IF condition is evaluated in Sybase 10

2 posts in General Discussion (old) Last posting was on 2009-03-31 12:27:11.0Z
Laura Ellison Posted on 2009-03-30 20:35:03.0Z
From: "Laura Ellison" <lellison@esc20.net>
Newsgroups: sybase.public.sqlanywhere
Subject: expressions resolved before IF condition is evaluated in Sybase 10
Lines: 42
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <49d12cf7$1@forums-1-dub>
Date: 30 Mar 2009 12:35:03 -0800
X-Trace: forums-1-dub 1238445303 10.22.241.152 (30 Mar 2009 12:35:03 -0800)
X-Original-Trace: 30 Mar 2009 12:35:03 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere:269
Article PK: 866709

A procedure that works in Sybase 9 provides incorrect results when run in
Sybase 10.



The following sql from the procedure resolves expressions for BOTH THEN and
ELSE expressions before resolving the condition.

date_range2 = IF @as_from_date = '' THEN '' ELSE

dateformat( @as_from_date , 'Mmm. dd') + ' - ' + dateformat( @as_to_date ,
'Mmm. dd') ENDIF



In Sybase 10 this statement results in an error "SQLCODE -157 SQLSTATE=53018
Invalid to convert time stamp" when @as_from_date is set to the empty value.

The statement works accurately in Sybase 9. We have not been able to find
the cause for this in the release notes.

Any help with this issue will be greatly appreciated.

Sincerely,

Laura Ellison


Breck Carter [TeamSybase] Posted on 2009-03-31 12:27:11.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__breck.carter@gmail.com>
Newsgroups: sybase.public.sqlanywhere
Subject: Re: expressions resolved before IF condition is evaluated in Sybase 10
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__breck.carter@gmail.com
Message-ID: <fp24t4timaue14kpc7e080ue3vi0mpa8cl@4ax.com>
References: <49d12cf7$1@forums-1-dub>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 31 Mar 2009 04:27:11 -0800
X-Trace: forums-1-dub 1238502431 10.22.241.152 (31 Mar 2009 04:27:11 -0800)
X-Original-Trace: 31 Mar 2009 04:27:11 -0800, vip152.sybase.com
Lines: 76
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere:270
Article PK: 866710

Please tell us the exact build number of version 10; e.g., 10.0.1.3415

Please show us the exact code, in its context, together with the data
types used for all the values/columns.

The following code seems to work ok in 9.0.2.3575, 10.0.1.3415 and
11.0.1.2044.

Breck

begin
DECLARE date_range2 VARCHAR ( 100 );
DECLARE @as_from_date VARCHAR ( 100 );
DECLARE @as_to_date VARCHAR ( 100 );
SET @as_from_date = '';
SET @as_to_date = '';
--SET @as_from_date = '2009-1-1';
--SET @as_to_date = '2009-12-31';
SET date_range2 = IF @as_from_date = '' THEN '' ELSE

dateformat( @as_from_date , 'Mmm. dd') + ' - ' + dateformat(
@as_to_date ,
'Mmm. dd') ENDIF;
SELECT date_range2;
END;

On 30 Mar 2009 12:35:03 -0800, "Laura Ellison" <lellison@esc20.net>

wrote:

>A procedure that works in Sybase 9 provides incorrect results when run in
>Sybase 10.
>
>
>
>The following sql from the procedure resolves expressions for BOTH THEN and
>ELSE expressions before resolving the condition.
>
>date_range2 = IF @as_from_date = '' THEN '' ELSE
>
>dateformat( @as_from_date , 'Mmm. dd') + ' - ' + dateformat( @as_to_date ,
>'Mmm. dd') ENDIF
>
>
>
>In Sybase 10 this statement results in an error "SQLCODE -157 SQLSTATE=53018
>Invalid to convert time stamp" when @as_from_date is set to the empty value.
>
>The statement works accurately in Sybase 9. We have not been able to find
>the cause for this in the release notes.
>
>Any help with this issue will be greatly appreciated.
>
>Sincerely,
>
>Laura Ellison
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

--
Breck Carter http://sqlanywhere.blogspot.com/

RisingRoad SQL Anywhere and MobiLink Professional Services
breck.carter@risingroad.com