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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T06:13:22+00:00 2026-05-19T06:13:22+00:00

I’ve got the following PL SQL function that returns a ref cursor but the

  • 0

I’ve got the following PL SQL function that returns a ref cursor but the application i am using does not support ref cursors. How can i make this code return something other than ref cursor

FUNCTION getADedIcWarningsProv(p_hos_id IN work_entity_data.hos_id%TYPE
                                ,p_date        IN DATE
                                )


RETURN eOdatatypes_package.eOrefcur
  IS

v_refcur eOdatatypes_package.eOrefcur;

BEGIN

OPEN v_refcur FOR
SELECT IF_type IF_type
      ,COUNT(*)       number_infected
FROM (SELECT DISTINCT bd.PT_id             PT_id
                     ,CASE WHEN NVL(O_package.get_O_code_property(pw.warning_code,'Setl'),'N') = 'Y'
                      THEN cd.description
                      ELSE 'Other'
                      END                       IF_type
      FROM PT_ad       pad
          ,BD_details      bd
          ,PT_warnings pw
          ,codes            cd
      WHERE bd.current_record = 'Y'
      AND   bd.BD_location IS NOT NULL
      AND   bd.BD_status IN (SELECT code
                                FROM codes
                               WHERE prog_code IN (1, 1, 2) 
                                 AND code_type = 4)
      AND   bd.AD_no = pad.AD_no
      AND   pad.hos_id = p_hos_id
      AND   pw.PT_id   = bd.PT_id
      AND   pw.warning_to IN ('D','Q')
      AND   p_date BETWEEN pw.applies_start
                       AND NVL(pw.applies_end,p_date)
      AND   NVL(O_package.get_O_code_property(pw.warning_code,'INFT'),'Y') = 'N'
      AND   pw.warning_code = cd.code)
GROUP BY IF_type
ORDER BY IF_type;
RETURN v_refcur;
END getADedIcWarningsProv;

OUTPUT:

IF_TYPE                           NUMBER_IF
---------------------------------------- ---------------
C                                                 2
M                                                 6
Other                                             4
3 rows selected
  • 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-19T06:13:23+00:00Added an answer on May 19, 2026 at 6:13 am

    You can use a pipeline function to return a result set one record at a time, but in a way that the SQL engine can understand.

    create or replace package WrapperSample is
    
      type TResultRow is record(
         if_type         codes.cd%type
        ,number_infected Integer);
    
      type TResultRowList is table of TResultRow;
    
      function GetADedIcWarningsProv
      (
        p_hos_id in work_entity_data.hos_id%type
       ,p_date   in date
      ) return TResultRowList
        pipelined;
    
    end WrapperSample;
    /
    
    create or replace package body WrapperSample is
    
      function GetADedIcWarningsProv
      (
        p_hos_id in work_entity_data.hos_id%type
       ,p_date   in date
      ) return TResultRowList
        pipelined is
        v_refcur   eOdatatypes_package.eOrefcur;
        currentRow TResultRow;
      begin
        v_refcur := YourSchema.getADedIcWarningsProv(p_hos_id, p_date);
    
        loop
          fetch v_refcur
            INTO currentRow;
          exit when v_refcur%NotFound;
          pipe row(currentRow);
        end loop;
    
        close v_refcur;
    
        return;
      end;
    
    end WrapperSample;
    /
    

    Using this package, you can select your ref cursor:

    SELECT if_type
          ,number_infected
    FROM table(WrapperSample.getADedIcWarningsProv(1, 2))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I have just tried to save a simple *.rtf file with some websites and

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.