UDB 8.2.2 specify statement-delimiter inside script?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • _link98@yahoo.com

    UDB 8.2.2 specify statement-delimiter inside script?

    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_DELIM ITER %".

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

  • Knut Stolze

    #2
    Re: UDB 8.2.2 specify statement-delimiter inside script?

    _link98@yahoo.c om 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_DELIM ITER %".[/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.



    --
    Knut Stolze
    Information Integration Development
    IBM Germany / University of Jena

    Comment

    • _link98@yahoo.com

      #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.

      Comment

      • Serge Rielau

        #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

        Comment

        • _link98@yahoo.com

          #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 "Documentat ion updates".

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

          Comment

          • Gert van der Kooij

            #6
            Re: UDB 8.2.2 specify statement-delimiter inside script?

            In article <1124805269.296 822.287270@o13g 2000cwo.googleg roups.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 "Documentat ion 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?

            Comment

            • Serge Rielau

              #7
              Re: UDB 8.2.2 specify statement-delimiter inside script?

              Gert van der Kooij wrote:[color=blue]
              > In article <1124805269.296 822.287270@o13g 2000cwo.googleg roups.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 "Documentat ion 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

              Comment

              • Gert van der Kooij

                #8
                Re: UDB 8.2.2 specify statement-delimiter inside script?

                In article <3n1mssF18vou5U 1@individual.ne t>, Serge Rielau
                (srielau@ca.ibm .com) says...[color=blue]
                > Gert van der Kooij wrote:[color=green]
                > > In article <1124805269.296 822.287270@o13g 2000cwo.googleg roups.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 "Documentat ion 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?

                Comment

                • Gert van der Kooij

                  #9
                  Re: UDB 8.2.2 specify statement-delimiter inside script?

                  In article <MPG.1d76bea580 f53e0a989872@ne ws.xs4all.nl>, Gert van der
                  Kooij (gert@invalid.n l) 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.

                  Comment

                  • Serge Rielau

                    #10
                    Re: UDB 8.2.2 specify statement-delimiter inside script?

                    Gert van der Kooij wrote:[color=blue]
                    > In article <MPG.1d76bea580 f53e0a989872@ne ws.xs4all.nl>, Gert van der
                    > Kooij (gert@invalid.n l) 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:


                    Cheers
                    Serge

                    --
                    Serge Rielau
                    DB2 SQL Compiler Development
                    IBM Toronto Lab

                    Comment

                    Working...