Professional Web Applications Themes

Multi command files and running them from the command prompt - IBM DB2

Use the -td§ option [where § is the desired character]. Details are in the section titled Command Line Processor Options in the Command Reference. "Derek Clarkson" <dclarksonwaterwerks.com.au> wrote in message news:3f406c14mail.netspeed.com.au... > Hello, > I have a problem. I have a number of functions which I need to load. > However these functions contain embedded semi-colons. For example > > (1) CREATE FUNCTION REVERSE(INSTR VARCHAR(4000)) RETURNS VARCHAR(4000) > (2) begin atomic > (3) return 'ABC'; > (4) end > > The problem is that if I have a .sql file containing this function and run > it like this: > ...

  1. #1

    Default Re: Multi command files and running them from the command prompt

    Use the -td§ option [where § is the desired character]. Details are in the
    section titled Command Line Processor Options in the Command Reference.

    "Derek Clarkson" <dclarksonwaterwerks.com.au> wrote in message
    news:3f406c14mail.netspeed.com.au...
    > Hello,
    > I have a problem. I have a number of functions which I need to
    load.
    > However these functions contain embedded semi-colons. For example
    >
    > (1) CREATE FUNCTION REVERSE(INSTR VARCHAR(4000)) RETURNS VARCHAR(4000)
    > (2) begin atomic
    > (3) return 'ABC';
    > (4) end
    >
    > The problem is that if I have a .sql file containing this function and run
    > it like this:
    >
    > db2 -t -f script.sql
    >
    > Then db2 gets to the semi-colon at the end of line 3 and assumes it is the
    > end of the create function command. Which generates an error. If I run the
    > script without the -t flag then DB2 gets to the end of the first line and
    > assumes thats it, resulting in another error.
    >
    > The only way we have found to run this is to apply back slashes to each
    > line, resulting in:
    >
    > (1) CREATE FUNCTION REVERSE(INSTR VARCHAR(4000)) RETURNS VARCHAR(4000) \
    > (2) begin atomic \
    > (3) return 'ABC'; \
    > (4) end
    >
    > Our preferred way would be to not have the back slashes and use
    semi-colons
    > to delimit commands. However the DB2 interpreter seems to not be able to
    > handle nested statements in functions like this.
    >
    > How have you guys handled this situation ? any thoughts or experience
    would
    > be appreciated.
    >
    > cio
    > Derek.

    Mark Yudkin Guest

  2. #2

    Default Re: Multi command files and running them from the command prompt

    Thanks guys, -td worked just fine.

    cio
    Derek.

    Derek Clarkson wrote:
    > Hello,
    > I have a problem. I have a number of functions which I need to
    > load.
    > However these functions contain embedded semi-colons. For example
    >
    > (1) CREATE FUNCTION REVERSE(INSTR VARCHAR(4000)) RETURNS VARCHAR(4000)
    > (2) begin atomic
    > (3) return 'ABC';
    > (4) end
    >
    > The problem is that if I have a .sql file containing this function and run
    > it like this:
    >
    > db2 -t -f script.sql
    >
    > Then db2 gets to the semi-colon at the end of line 3 and assumes it is the
    > end of the create function command. Which generates an error. If I run the
    > script without the -t flag then DB2 gets to the end of the first line and
    > assumes thats it, resulting in another error.
    >
    > The only way we have found to run this is to apply back slashes to each
    > line, resulting in:
    >
    > (1) CREATE FUNCTION REVERSE(INSTR VARCHAR(4000)) RETURNS VARCHAR(4000) \
    > (2) begin atomic \
    > (3) return 'ABC'; \
    > (4) end
    >
    > Our preferred way would be to not have the back slashes and use
    > semi-colons to delimit commands. However the DB2 interpreter seems to not
    > be able to handle nested statements in functions like this.
    >
    > How have you guys handled this situation ? any thoughts or experience
    > would be appreciated.
    >
    > cio
    > Derek.
    Derek Clarkson Guest

Similar Threads

  1. Trying to compile a cs from command prompt
    By wouldliketoknow in forum Dreamweaver AppDev
    Replies: 0
    Last Post: March 27th, 02:42 AM
  2. flash and command prompt
    By morphC2004 in forum Macromedia Flash
    Replies: 1
    Last Post: February 6th, 10:47 PM
  3. how to restrict command prompt
    By zuhair in forum Windows Setup, Administration & Security
    Replies: 2
    Last Post: July 23rd, 09:22 PM
  4. Problem with the Command Prompt
    By Junaid Kapadia in forum Windows Setup, Administration & Security
    Replies: 0
    Last Post: July 20th, 08:51 AM
  5. FTP Error from command prompt
    By Matthew in forum Windows Networking
    Replies: 0
    Last Post: July 15th, 08:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139