Professional Web Applications Themes

Using SQL to generate SQL and execute it - IBM DB2

I am able to use SQL to dynamically generate another SQL statement. I would like to be able to execute this newly generated SQL without the use of an external wrapper, such as a stored procedure, or shell script. If I were to store the new SQL in a table, is there a way to write a new statement that extracts the stored SQL and have it execute all at once? Or is there another methodology altogether to do this? Thanks, Evan...

  1. #1

    Default Using SQL to generate SQL and execute it

    I am able to use SQL to dynamically generate another SQL statement. I
    would like to be able to execute this newly generated SQL without the
    use of an external wrapper, such as a stored procedure, or shell
    script. If I were to store the new SQL in a table, is there a way to
    write a new statement that extracts the stored SQL and have it execute
    all at once? Or is there another methodology altogether to do this?

    Thanks,
    Evan
    Evan Smith Guest

  2. #2

    Default Re: Using SQL to generate SQL and execute it

    No. This is usually done using an SQL Procedure or an external UDF.
    Can you state the reason why neither is feasible?

    Cheers
    Serge

    --
    Serge Rielau
    DB2 UDB SQL Compiler Development
    IBM Software Lab, Toronto

    Visit DB2 Developer Domain at
    [url]http://www7b.software.ibm.com/dmdd/[/url]

    Serge Rielau Guest

  3. #3

    Default Re: Using SQL to generate SQL and execute it

    I see... Here is a trick you may try (no warranty).
    Create a procedure that takes the statement to be compiled and executes it.
    Create a exterbal UDF (C/Java) that CALLs the stored proc.
    The you can use that UDF in your SQL.
    Cheers
    Serge


    Serge Rielau Guest

Similar Threads

  1. Question Execute SQL satatements in perl using DBI execute method
    By bennjoe in forum Brainstorming Area
    Replies: 0
    Last Post: October 7th, 04:53 PM
  2. Generate XML from CFC...HELP
    By cfhottie in forum Coldfusion - Advanced Techniques
    Replies: 5
    Last Post: May 17th, 08:07 PM
  3. Can't generate a .ps file
    By Michael_Galvin@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 11
    Last Post: August 31st, 04:01 AM
  4. php generate thumbnails
    By Russell Conder in forum PHP Development
    Replies: 0
    Last Post: September 14th, 11:04 AM

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