sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
_link98@yahoo.com's Avatar

UDB 8.2.2 specify statement-delimiter inside script?


Question posted by: _link98@yahoo.com (Guest) on November 12th, 2005 11:40 AM
Normally I use the semicolon for statement delimiters in plain SQL
scripts (for DDL, simple DML etc.).

But inside SQL/PL I tend to use % or @ as statement delimiters. But
other people prefer other delimiters.

I know that I can use the CLP option "-td" to specify the delimiter on
the command line, when invoking the script. But this requires me to
look inside the scripts to find the delimiter before I run the script.

It would be nice for the script itself to be able to declare its own
delimiter inside itself, thereby allowing calling scripts to not-care
about which delimiter(s) are used inside of any particular script, and
if the script did not make any such declaration then some default (like
semicolon etc) would apply. Something like "SET STATEMENT_DELIMITER %".

Someone told me there was something for this in new versions of DB2,
but I cannot find it yet.

9 Answers Posted
Knut Stolze's Avatar
Guest - n/a Posts
#2: Re: UDB 8.2.2 specify statement-delimiter inside script?

Join Bytes! wrote:
[color=blue]
> Normally I use the semicolon for statement delimiters in plain SQL
> scripts (for DDL, simple DML etc.).
>
> But inside SQL/PL I tend to use % or @ as statement delimiters. But
> other people prefer other delimiters.
>
> I know that I can use the CLP option "-td" to specify the delimiter on
> the command line, when invoking the script. But this requires me to
> look inside the scripts to find the delimiter before I run the script.
>
> It would be nice for the script itself to be able to declare its own
> delimiter inside itself, thereby allowing calling scripts to not-care
> about which delimiter(s) are used inside of any particular script, and
> if the script did not make any such declaration then some default (like
> semicolon etc) would apply. Something like "SET STATEMENT_DELIMITER %".[/color]

In the DB2 doc I just find this:

Statement Termination Character Option (-t):

The -t option tells the command line processor to use a semicolon (;) as
the statement termination character, and disables the backslash (\) line
continuation character.

Note:
This option *cannot* be changed from within the interactive mode.

http://publib.boulder.ibm.com/infoc...re/r0010410.htm

--
Knut Stolze
Information Integration Development
IBM Germany / University of Jena
_link98@yahoo.com's Avatar
_link98@yahoo.com November 12th, 2005 11:40 AM
Guest - n/a Posts
#3: Re: UDB 8.2.2 specify statement-delimiter inside script?

Knut, It seems you answered a different question than the one that I
asked.

The -t option is not settable *inside* a script (via "update command
options"), according to the docs
..
I'm asking if a script can specify its delimiter inside the file,
rather than via the command-line. I know I can parse the file to find
the delimiter, but it seems a kludge.

Serge Rielau's Avatar
Guest - n/a Posts
#4: Re: UDB 8.2.2 specify statement-delimiter inside script?

db2 => --#SET TERMINATOR %
db2 => values 1%

1
-----------
1

1 record(s) selected.

db2 => --#SET TERMINATOR ;
db2 => values 1;

1
-----------
1

1 record(s) selected.

db2 =>

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
_link98@yahoo.com's Avatar
_link98@yahoo.com November 12th, 2005 11:40 AM
Guest - n/a Posts
#5: Re: UDB 8.2.2 specify statement-delimiter inside script?


Magic.

Thanks Serge.

Now that I see the syntax, this info has made it into the online
infocentre under "Documentation updates".

Since fp1 of v8.1. Message to self: ingest that section as carefully as
the release notes.

Gert van der Kooij's Avatar
Gert van der Kooij November 12th, 2005 11:40 AM
Guest - n/a Posts
#6: Re: UDB 8.2.2 specify statement-delimiter inside script?

In article <1124805269.296822.287270@o13g2000cwo.googlegroups. com>,
(_link98@yahoo.com) says...[color=blue]
>
> Magic.
>
> Thanks Serge.
>
> Now that I see the syntax, this info has made it into the online
> infocentre under "Documentation updates".
>
> Since fp1 of v8.1. Message to self: ingest that section as carefully as
> the release notes.
>
>[/color]

I only could find it in the Db2 z/OS docs, not in the DB2
Unix/Windows docs. Did I miss it?
Serge Rielau's Avatar
Guest - n/a Posts
#7: Re: UDB 8.2.2 specify statement-delimiter inside script?

Gert van der Kooij wrote:[color=blue]
> In article <1124805269.296822.287270@o13g2000cwo.googlegroups. com>,
> (_link98@yahoo.com) says...
>[color=green]
>>Magic.
>>
>>Thanks Serge.
>>
>>Now that I see the syntax, this info has made it into the online
>>infocentre under "Documentation updates".
>>
>>Since fp1 of v8.1. Message to self: ingest that section as carefully as
>>the release notes.
>>
>>[/color]
>
>
> I only could find it in the Db2 z/OS docs, not in the DB2
> Unix/Windows docs. Did I miss it?[/color]
New in FP8 you need to go to the online docs @boulder

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Gert van der Kooij's Avatar
Gert van der Kooij November 12th, 2005 11:41 AM
Guest - n/a Posts
#8: Re: UDB 8.2.2 specify statement-delimiter inside script?

In article <3n1mssF18vou5U1@individual.net>, Serge Rielau
(srielau@ca.ibm.com) says...[color=blue]
> Gert van der Kooij wrote:[color=green]
> > In article <1124805269.296822.287270@o13g2000cwo.googlegroups. com>,
> > (_link98@yahoo.com) says...
> >[color=darkred]
> >>Magic.
> >>
> >>Thanks Serge.
> >>
> >>Now that I see the syntax, this info has made it into the online
> >>infocentre under "Documentation updates".
> >>
> >>Since fp1 of v8.1. Message to self: ingest that section as carefully as
> >>the release notes.
> >>
> >>[/color]
> >
> >
> > I only could find it in the Db2 z/OS docs, not in the DB2
> > Unix/Windows docs. Did I miss it?[/color]
> New in FP8 you need to go to the online docs @boulder
>
> Cheers
> Serge
>[/color]

Could not find it there either, can you post a (tiny) url?
Gert van der Kooij's Avatar
Gert van der Kooij November 12th, 2005 11:41 AM
Guest - n/a Posts
#9: Re: UDB 8.2.2 specify statement-delimiter inside script?

In article <MPG.1d76bea580f53e0a989872@news.xs4all.nl>, Gert van der
Kooij (gert@invalid.nl) says...[color=blue][color=green]
> > New in FP8 you need to go to the online docs @boulder
> >
> > Cheers
> > Serge
> >[/color]
>
> Could not find it there either, can you post a (tiny) url?
>[/color]

Sorry, found it allready.
Serge Rielau's Avatar
Guest - n/a Posts
#10: Re: UDB 8.2.2 specify statement-delimiter inside script?

Gert van der Kooij wrote:[color=blue]
> In article <MPG.1d76bea580f53e0a989872@news.xs4all.nl>, Gert van der
> Kooij (gert@invalid.nl) says...
>[color=green][color=darkred]
>>>New in FP8 you need to go to the online docs @boulder
>>>
>>>Cheers
>>>Serge
>>>[/color]
>>
>>Could not find it there either, can you post a (tiny) url?
>>[/color]
>
>
> Sorry, found it allready.[/color]
well, now that I had to learn how to make tiny URLs you get it anyway:
http://tinyurl.com/ba4po

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
 
Not the answer you were looking for? Post your question . . .
196,931 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,931 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors