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.

BEGIN/END

5 posts in General Discussion Last posting was on 2003-05-20 19:50:56.0Z
Richard Posted on 2003-05-14 20:56:18.0Z
From: Richard
Date: Wed, 14 May 2003 16:56:18 -0400
Newsgroups: ianywhere.public.general
Subject: BEGIN/END
Message-ID: <5BCC3ED6105DC9AB007304D785256D26.007304E885256D26@webforums>
Lines: 1
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:1018
Article PK: 3343

What is the best practice when using the BEGIN...END Statements?


Robert Waywell Posted on 2003-05-15 16:41:19.0Z
From: "Robert Waywell" <nospam_rwaywell@ianywhere.com>
References: <5BCC3ED6105DC9AB007304D785256D26.007304E885256D26@webforums>
Subject: Re: BEGIN/END
Date: Thu, 15 May 2003 12:41:19 -0400
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <#ShBuGwGDHA.358@forums-2-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: rwaywell-pc.sybase.com 172.31.143.74
Path: forums-1-dub!forums-master.sybase.com!forums-2-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:1022
Article PK: 3346

Could you elaborate on what you are looking for? The BEGIN/END pairs delimit
a batch, they aren't transactional delimiters.

--
-----------------------------------------------
Robert Waywell
Sybase Adaptive Server Anywhere Developer - Version 8
Sybase Certified Professional

Sybase's iAnywhere Solutions

Please respond ONLY to newsgroup

EBF's and Patches: http://downloads.sybase.com
choose SQL Anywhere Studio >> change 'time frame' to all

To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm

SQL Anywhere Studio Supported Platforms and Support Status
http://my.sybase.com/detail?id=1002288

Whitepapers, TechDocs, and bug fixes are all available through the iAnywhere
Developer Community at www.ianywhere.com/developer

<Richard> wrote in message
news:5BCC3ED6105DC9AB007304D785256D26.007304E885256D26@webforums...
> What is the best practice when using the BEGIN...END Statements?


Richard Posted on 2003-05-16 16:35:58.0Z
From: Richard
Date: Fri, 16 May 2003 12:35:58 -0400
Newsgroups: ianywhere.public.general
Subject: Re: BEGIN/END
Message-ID: <7B051C675F1E4D59005B2F3385256D28.00615D0585256D27@webforums>
References: <5BCC3ED6105DC9AB007304D785256D26.007304E885256D26@webforums> <#ShBuGwGDHA.358@forums-2-dub>
Lines: 32
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:1027
Article PK: 2992

I was just looking for a best practice for when using Stored
Procedures...for example:

CREATE Proc TestA @var int AS
BEGIN
IF @var=1
BEGIN
PRINT '1'
END
ELSE
BEGIN
PRINT 'Not 1'
END
END

-- OR --

CREATE Proc TestA @var int AS
IF @var=1 BEGIN
PRINT '1'
END ELSE BEGIN
PRINT 'Not 1'
END

-- OR --

CREATE Proc TestA @var int AS
IF @var=1 PRINT '1'
ELSE PRINT 'Not 1'


Thanks


Breck Carter [TeamSybase] Posted on 2003-05-16 16:53:26.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Subject: Re: BEGIN/END
Date: Fri, 16 May 2003 12:53:26 -0400
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <hm5acvkkpn69lvc9l8l87ceae9qfp1j31h@4ax.com>
References: <5BCC3ED6105DC9AB007304D785256D26.007304E885256D26@webforums> <#ShBuGwGDHA.358@forums-2-dub> <7B051C675F1E4D59005B2F3385256D28.00615D0585256D27@webforums>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: nnc010.canpar.ca 204.225.91.186
Lines: 30
Path: forums-1-dub!forums-master.sybase.com!forums-1-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:1031
Article PK: 2995

The Watcom SQL syntax is suggested, which does not require the use of
extra BEGIN END delimiters. It does, however, require END IF.

IF condition THEN
one or more statements;
IF condition THEN
etcetera;
ELSE
one or more statements;
END IF;
ELSE
and_so_on;
END IF;

There is also an ELSEIF construction which is often handy, and two
formats of CASE.

If you are coming from the world of Transact SQL, try to forget as
much of that as you can :)

Breck Hey He Asked About Best Practices

On Fri, 16 May 2003 12:35:58 -0400, Richard wrote:

>I was just looking for a best practice for when using Stored
>Procedures...for example:
>
>CREATE Proc TestA @var int AS
>BEGIN
> IF @var=1
> BEGIN
> PRINT '1'
> END
> ELSE
> BEGIN
> PRINT 'Not 1'
> END
>END
>
>-- OR --
>
>CREATE Proc TestA @var int AS
> IF @var=1 BEGIN
> PRINT '1'
> END ELSE BEGIN
> PRINT 'Not 1'
> END
>
>-- OR --
>
>CREATE Proc TestA @var int AS
> IF @var=1 PRINT '1'
> ELSE PRINT 'Not 1'
>
>
>Thanks

bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
http://www.risingroad.com


Robert Waywell Posted on 2003-05-20 19:50:56.0Z
From: "Robert Waywell" <nospam_rwaywell@ianywhere.com>
References: <5BCC3ED6105DC9AB007304D785256D26.007304E885256D26@webforums> <#ShBuGwGDHA.358@forums-2-dub> <7B051C675F1E4D59005B2F3385256D28.00615D0585256D27@webforums> <hm5acvkkpn69lvc9l8l87ceae9qfp1j31h@4ax.com>
Subject: Re: BEGIN/END
Date: Tue, 20 May 2003 15:50:56 -0400
Lines: 95
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <O3B1FowHDHA.185@forums-2-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: rwaywell-pc.sybase.com 172.31.143.74
Path: forums-1-dub!forums-master.sybase.com!forums-2-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:1044
Article PK: 3002

Note also that CREATE PROCEDURE ... AS is the TSQL dialect as opposed to the
'Watcom SQL' dialect which uses the BEGIN/END to delimit the bounds of the
compound statement that is the body of the procedure:

CREATE PROCEDURE ...
BEGIN
...
END


--
-----------------------------------------------
Robert Waywell
Sybase Adaptive Server Anywhere Developer - Version 8
Sybase Certified Professional

Sybase's iAnywhere Solutions

Please respond ONLY to newsgroup

EBF's and Patches: http://downloads.sybase.com
choose SQL Anywhere Studio >> change 'time frame' to all

To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm

SQL Anywhere Studio Supported Platforms and Support Status
http://my.sybase.com/detail?id=1002288

Whitepapers, TechDocs, and bug fixes are all available through the iAnywhere
Developer Community at www.ianywhere.com/developer

"Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com> wrote in
message news:hm5acvkkpn69lvc9l8l87ceae9qfp1j31h@4ax.com...
> The Watcom SQL syntax is suggested, which does not require the use of
> extra BEGIN END delimiters. It does, however, require END IF.
>
> IF condition THEN
> one or more statements;
> IF condition THEN
> etcetera;
> ELSE
> one or more statements;
> END IF;
> ELSE
> and_so_on;
> END IF;
>
> There is also an ELSEIF construction which is often handy, and two
> formats of CASE.
>
> If you are coming from the world of Transact SQL, try to forget as
> much of that as you can :)
>
> Breck Hey He Asked About Best Practices
>
> On Fri, 16 May 2003 12:35:58 -0400, Richard wrote:
>
> >I was just looking for a best practice for when using Stored
> >Procedures...for example:
> >
> >CREATE Proc TestA @var int AS
> >BEGIN
> > IF @var=1
> > BEGIN
> > PRINT '1'
> > END
> > ELSE
> > BEGIN
> > PRINT 'Not 1'
> > END
> >END
> >
> >-- OR --
> >
> >CREATE Proc TestA @var int AS
> > IF @var=1 BEGIN
> > PRINT '1'
> > END ELSE BEGIN
> > PRINT 'Not 1'
> > END
> >
> >-- OR --
> >
> >CREATE Proc TestA @var int AS
> > IF @var=1 PRINT '1'
> > ELSE PRINT 'Not 1'
> >
> >
> >Thanks
>
> bcarter@risingroad.com
> Mobile and Distributed Enterprise Database Applications
> http://www.risingroad.com