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 3663072
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:29:19+00:00 2026-05-19T01:29:19+00:00

I need to write a sproc which performs some INSERTs on a table, and

  • 0

I need to write a sproc which performs some INSERTs on a table, and compile a list of “statuses” for each row based on how well the INSERT went. Each row will be inserted within a loop, the loop iterates over a cursor that supplies some values for the INSERT statement. What I need to return is a resultset which looks like this:

FIELDS_FROM_ROW_BEING_INSERTED.., STATUS VARCHAR2

The STATUS is determined by how the INSERT went. For instance, if the INSERT caused a DUP_VAL_ON_INDEX exception indicating there was a duplicate row, I’d set the STATUS to “Dupe”. If all went well, I’d set it to “SUCCESS” and proceed to the next row.

By the end of it all, I’d have a resultset of N rows, where N is the number of insert statements performed and each row contains some identifying info for the row being inserted, along with the “STATUS” of the insertion

Since there is no table in my DB to store the values I’d like to pass back to the user, I’m wondering how I can return the info back? Temporary table? Seems in Oracle temporary tables are “global”, not sure I would want a global table, are there any temporary tables that get dropped after a session is done?

  • 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-19T01:29:19+00:00Added an answer on May 19, 2026 at 1:29 am

    “Global” in the case of temporary tables just means they are permanent, it’s the data which is temporary.

    I would define a record type that matches your cursor, plus the status field. Then define a table of that type.

    TYPE t_record IS
    (
        field_1,
        ...
        field_n,
        status VARCHAR2(30)
    );
    
    TYPE t_table IS TABLE OF t_record;
    
    FUNCTION insert_records
    (
        p_rows_to_insert IN SYS_REFCURSOR
    )
        RETURN t_table;
    

    Even better would be to also define the inputs as a table type instead of a cursor.

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

Sidebar

Related Questions

I need to write an application that will take a list of files (some
Need to write a quick method static boolean varTest(String id) that tests of the
SQL 2008. I am running sproc from SQL Studio and when I try to
i found XMPP on google (i need create a application IM look like Yahoo
My plugin needs to be able to write to the file system. Is it
i have text file, in file i have lines: param1=text1 param2=text2 And i need
hi i am trying to show image of my file in previwew pane i
I want to add short info in the beginning of the program and i
My aim is to Sanitize a string. The class should do: trim an input

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.