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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:05:00+00:00 2026-05-27T00:05:00+00:00

I have to write an Oracle procedure which should invoke an Oracle function returning

  • 0

I have to write an Oracle procedure which should invoke an Oracle function returning REF_CURSOR. The function is declared like that

FUNCTION "IMPACTNET"."TF_CONVERTPARA" (PARASTRING IN NVARCHAR2) RETURN SYS_REFCURSOR
AS
  c SYS_REFCURSOR;
BEGIN
    OPEN c FOR         
        SELECT SUBSTR(element, 1, INSTR(element, '|') - 1)     as key,
               SUBSTR(element, INSTR(element, '|') + 1, 99999) as val
        FROM (
            SELECT REGEXP_SUBSTR(PARASTRING, '[^;]+', 1, LEVEL) element          
                FROM dual      
                CONNECT BY LEVEL < LENGTH(REGEXP_REPLACE(PARASTRING, '[^;]+')) + 1
             );
    RETURN c;     
END;

Can you tell me what I need to write in order to invoke the function from within my procedure? I’d like to insert all the returned values (shaped a table with two columns) into a rational table.

Thank you in advance!

  • 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-27T00:05:01+00:00Added an answer on May 27, 2026 at 12:05 am

    Something along the lines of this should work (obviously, I’m guessing about table names and column names and the exact logic that you’re trying to implement)

    CREATE PROCEDURE some_procedure_name
    AS
      l_rc  SYS_REFCURSOR := impactnet.tf_convertpara( <<some string>> );
      l_key VARCHAR2(100);
      l_val VARCHAR2(100);
    BEGIN
      LOOP
        FETCH l_rc
          INTO l_key, l_val;
        EXIT WHEN l_rc%notfound;
    
        INSERT INTO some_table( key_column, val_column )
          VALUES( l_key, l_val );
      END LOOP;
    END;
    

    As Ollie points out, it would be more efficient to do a BULK COLLECT and a FORALL. If you’re just dealing with a few thousand rows (since your function is just parsing the data in a delimited string, I’m assuming you expect relatively few rows to be returned), the performance difference is probably minimal. But if you’re processing more data, the difference can be quite noticeable. Depending on the Oracle version and your specific requirements, you may be able to simplify the INSERT statement in the FORALL to insert a record rather than listing each column from the record individually.

    CREATE PROCEDURE some_procedure_name
    AS
      TYPE key_val_rec 
        IS RECORD( 
             key  VARCHAR2(100),
             val  VARCHAR2(100)
        );
      TYPE key_val_coll
        IS TABLE OF key_val_rec;
    
      l_rc   SYS_REFCURSOR := impactnet.tf_convertpara( <<some string>> );
      l_coll key_val_coll;
    BEGIN
      LOOP
        FETCH l_rc
          BULK COLLECT INTO l_coll
         LIMIT 100;
        EXIT WHEN l_coll.count = 0;
    
        FORALL i IN l_coll.FIRST .. l_coll.LAST
          INSERT INTO some_table( key_column, val_column )
            VALUES( l_coll(i).key, l_coll(i).val );
      END LOOP;
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to write a stored procedure in Oracle (which I have come to
I need to write a procedure to normalize a record that have multiple tokens
I have to call a stored procedure from oracle sever that not under our
I'm using Squirrel SQL with Oracle. I often have to write quick queries for
I have an oracle database populated with million records. I am trying to write
The debug screen says that django does not have write access to the db.
I'm working on an application so i have write an dll which contain a
I'm writing a simple web app in PHP that needs to have write access
I have to write an applet that brings up a password dialog. The problem
I am trying to write a simple Oracle Stored Procedure: CREATE OR REPLACE PROCEDURE

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.