1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

difference between temporary table and global temporary table

Discussion in 'General' started by harshith, Nov 7, 2011.

  1. harshith

    harshith Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    What is the difference between temporary table and global temporary table?
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,265
    Likes Received:
    336
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    A temporary table is owned by the person who created it and can only be accessed by that user. A global temporary table is accessible to everyone and will contain data specific to the session using it; multiple sessions can use the same global temporary table simultaneously. It is basically a global definition for a temporary table that all can benefit from.
     
    harshith likes this.
  3. harshith

    harshith Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    thanks David Fitzjarrell
     
  4. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    But In Oracle , temporary table is same as Global temporary table. You just cannot create a temp table without the keyword "global" in Oracle.
     
  5. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,265
    Likes Received:
    336
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    This is true but we do get questions regarding other databases and SQL Server/Sybase offer both local and global temporary tables. MySQL only offers local temporary tables.

    Since the question was not database-specific (yes, I know this is for the most part an Oracle forum) I answered generically.