Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2011
    Posts
    57

    Question Unanswered: Deleting Temporary table

    Hi expert!

    I've got a big issue whit a SP, I'm declaring temporary tables, but when I run it a SQL error finish the sp without droping temporary tables, I try to run again the sp but send me the next error:
    HTML Code:
    The name of the object to be created is identical to the existing name "SESSION.DATOS_XML" of type "DECLARED TEMPORARY TABLE".. SQLCODE=-601, SQLSTATE=42710, DRIVER=3.61.65
    I wonder if is anyway to look for the temporary table at the beginning of SP and if exist drop it and then create it. I've got another issue, in the enviroment where I've got the SP I don't have whole acess and premissions.

  2. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    In the SP, when you declare the temporary table, use the WITH REPLACE clause

  3. #3
    Join Date
    Sep 2011
    Posts
    57
    Thanks it works. I've got a doubt with this sentence, If there's any information inside the temporary table, this sentence delete all?

    Regards.

  4. #4
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    Yes, it is the same as dropping the table (if it exists), and then creating it again.

    The db2 on-line documentation explains all of this, and also shows example programs...

  5. #5
    Join Date
    Sep 2011
    Posts
    57
    Thanks a lot for your help.
    Regards.

Posting Permissions

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