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

  • Home
  • SEARCH
  • 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 8394205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:59:45+00:00 2026-06-09T19:59:45+00:00

I have a package P and a precedure A in it. create or replace

  • 0

I have a package P and a precedure A in it.

create or replace package pkg_get_users_info_by_role
as 
type user_info_ref_cur is ref cursor;
procedure get_user_info_proc 
(p_role_name varchar2, p_user_info out user_info_ref_cur);
end pkg_get_users_info_by_role;
/

and the body;

create or replace package body pkg_get_users_info_by_role
as 
procedure get_user_info_proc
(p_role_name varchar2, p_user_info out user_info_ref_cur)
as
begin
open p_user_info for 
select user_id,username,user_password,role_name from user_info,role_info
where user_info.user_role=role_info.role_id 
and role_info.role_name like p_role_name; 
end; 
end pkg_get_users_info_by_role;

My question is, how can I call the procedure? Do I need a variable of pkg_get_users_info_by_role.user_info_ref_cur type to call it? I cannot create a variable of this type. Is there any way to solve this?

Thanks!!

  • 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-06-09T19:59:47+00:00Added an answer on June 9, 2026 at 7:59 pm

    Yes, you simply define your cursor in your calling program as the package.type. Here’s a simple-minded illustration that should work on most any oracle database:

    CREATE OR REPLACE PACKAGE pkg AS
    TYPE rc IS REF CURSOR;
    PROCEDURE get_rc(p_rc OUT rc);
    END pkg;
    /
    CREATE OR REPLACE PACKAGE BODY pkg AS
    PROCEDURE get_rc(p_rc OUT rc) IS
    BEGIN
      OPEN p_rc FOR
      SELECT t.owner, t.table_name FROM all_tables t;
    END get_rc;
    END pkg;
    /
    
    DECLARE
      crsr pkg.rc;
      v1 VARCHAR2(32);
      v2 VARCHAR2(32);
    BEGIN
      pkg.get_rc(crsr);
      LOOP
        EXIT WHEN crsr%NOTFOUND;
        FETCH crsr INTO v1, v2;
        dbms_output.put_line(v1||': '||v2);
      END LOOP;
      CLOSE crsr;
    END;
    /
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written this package CREATE OR REPLACE PACKAGE CURVES AS type t_forecast_values is
I have this procedure i my package: PROCEDURE pr_export_blob( p_name IN VARCHAR2, p_blob IN
All, I have the following Package Description: CREATE OR REPLACE PACKAGE ashish.PKG_Customer AUTHID CURRENT_USER
We have an Oracle type that's declared as such: CREATE OR REPLACE TYPE its_accountarray;
My procedure is declare here : create or replace PACKAGE MYPKG IS PROCEDURE MYPROCEDURE(
Actually i have created following procedure,which is working fine. CREATE or REPLACE PROCEDURE GET_NOS(
I have one package contains many Stored Procedure for populating diffrent tables. This package
I have set up an Oracle Package with a procedure similar to the code
PACKAGE PKG_DEVICE AS TYPE STR_ASSOC_ARR is table of VARCHAR(255) index by BINARY_INTEGER; procedure proc_create_device
How do I create a Java package for different files? I have tried the

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.