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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:15:06+00:00 2026-05-26T18:15:06+00:00

I have a stored procedure. I want to call a function from it. Want

  • 0

I have a stored procedure. I want to call a function from it. Want to pass the retrieved cursor record to the function. how can i pass the retrieved cursor record as function argument and how can i access it inside the function? How do i declare the function?

CREATE OR REPLACE PROCEDURE service__update as

cursor c_getData is
    select    *
    from  service_1
    where status=5    ;


begin
    dbms_output.enable(null);    

    for rec in c_getData loop

    function(rec)
  • 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-26T18:15:07+00:00Added an answer on May 26, 2026 at 6:15 pm

    Assuming that you really want a function (which implies that you want to return a value) rather than a procedure (which does not return a value) and assuming that your cursor really is selecting every column from a single table, you can declare a function that takes an anchored %ROWTYPE

    SQL> create function get_empno( p_rec in emp%rowtype )
      2    return number
      3  is
      4  begin
      5    return p_rec.empno;
      6  end;
      7  /
    
    Function created.
    

    and then call that function from your procedure

    SQL> declare
      2    l_empno emp.empno%type;
      3  begin
      4    for i in (select * from emp)
      5    loop
      6      l_empno := get_empno( i );
      7      dbms_output.put_line( l_empno );
      8    end loop;
      9  end;
     10  /
    7369
    7499
    7521
    7566
    7654
    7698
    7782
    7788
    7839
    7844
    7876
    7900
    7902
    7934
    
    PL/SQL procedure successfully completed.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored procedure that I want to call from within another, and
I want to (loosely) have a stored procedure like select * from table where
I want to be able to have a Stored Procedure that can only be
I have a somewhat-long-running stored procedure being called from a PB application. I want
I have written a PLSQL stored procedure , i want to call the procedure
I have stored procedure that I created in MySQL and want PHP to call
I have a stored procedure in which i want to create a user defined
I have a Stored Procedure that rolls-back a series of operations. I want to
I have a MYSQL stored procedure SP1() that returns a result set. I want
I have a large CSV file and I want to execute a stored 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.