0

Can I use DML in from clause in DB2? thank you

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
derrdji
  • 12,661
  • 21
  • 68
  • 78
  • Maybe if you describe your use case, a better solution can be found. While I'm not sure if it's technically possible it wouldn't seem like good style to me, even if it works. – Martin Klinke May 28 '10 at 19:25
  • maybe I can save an API call, or need the table temporarily – derrdji May 28 '10 at 19:32
  • ~ I think @Martin Klinke has a good point, can you actually describe the use case, or illustrate what it is you're trying to accomplish? The API call as you put it doesn't really apply to SQL. You can combine multiple queries into one database call if that's what you're worried about. But remember the KISS principle, let each command/function/named-group-of-operators do one thing and do it well. `No Side Effects` – jcolebrand May 28 '10 at 19:38

2 Answers2

0

Why would you do that? I don't think I've ever seen that in an SQL statement...

jcolebrand
  • 15,889
  • 12
  • 75
  • 121
0

The DB2 V9 SQL Reference states that the FROM clause can only contain a table-reference:

     .-,---------------.   
     V                 |   
>>-FROM----table-reference-+-----------------------------------><

The description of "table-reference" is directly below that, so it will tell you exactly what is allowed and what is not allowed. A table-reference can include "Data change table references," one of which is "NEW TABLE." Maybe that's what you're after, but as other people have already said, without knowing what you're trying to do, it's hard to answer the question.

SQL Syntax diagram for table-reference (scroll about 1/4 down the page)

Michael Sharek
  • 5,043
  • 2
  • 30
  • 33