Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6355259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:43:44+00:00 2026-05-24T22:43:44+00:00

I noticed that the concept of temporary tables in these two systems is different,

  • 0

I noticed that the concept of temporary tables in these two systems is different, and I have a musing.. I have the following scenario in MySQL:

  1. Drop temporary table ‘a’ if exists
  2. Create temporary table ‘a’
  3. Populate it with data through a stored procedure
  4. Use the data in another stored procedure

How can I implement the same scenario in Oracle? Can I (in one procedure preferable) create a temporary table, populate it, and insert data in another (non-temporary) table?

I think that I can use a (global) temporary table which truncates on commit, and avoid steps 1&2, but I need someone else’s opinion too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:43:44+00:00Added an answer on May 24, 2026 at 10:43 pm

    In Oracle, you very rarely need a temporary table in the first place. You commonly need temporary tables in other databases because those databases do not implement multi-version read consistency and there is the potential that someone reading data from the table would be blocked while your procedure runs or that your procedure would do a dirty read if it didn’t save off the data to a separate structure. You don’t need global temporary tables in Oracle for either of these reasons because readers don’t block writers and dirty reads are not possible.

    If you just need a temporary place to store data while you perform PL/SQL computations, PL/SQL collections are more commonly used than temporary tables in Oracle. This way, you’re not pushing data back and forth from the PL/SQL engine to the SQL engine and back to the PL/SQL engine.

    CREATE PROCEDURE do_some_processing
    AS
      TYPE emp_collection_typ IS TABLE OF emp%rowtype;
      l_emps emp_collection_type;
    
      CURSOR emp_cur
          IS SELECT *
               FROM emp;
    BEGIN
      OPEN emp_cur;
      LOOP
        FETCH emp_cur 
         BULK COLLECT INTO l_emps
        LIMIT 100;
    
        EXIT WHEN l_emps.count = 0;
    
        FOR i IN 1 .. l_emps.count
        LOOP
          <<do some complicated processing>>
        END LOOP;
      END LOOP;
    END;
    

    You can create a global temporary table (outside of the procedure) and use the global temporary table inside your procedure just as you would use any other table. So you can continue to use temporary tables if you so desire. But I can count on one hand the number of times I really needed a temporary table in Oracle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that various systems use various characters as the replacent for illegal ones
I noticed that every time that I restart my computer I have to do
I noticed that the fact tables used in a cube were actually views. Infact
I've noticed that just in the last year or so, many major websites have
A phrase that I've noticed recently is the concept of point free style... First,
I noticed that the Smalltalk language has no concept of private/protected methods. All methods
I have noticed that when writing specs you waste a lot of time on
I noticed that on my Vista and XP machines, the automatic update is asking
I noticed that JavaScript's new Date() function is very smart in accepting dates in
We noticed that when testNG test cases extend TestCase (JUnit) those tests start executing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.