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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:44:30+00:00 2026-06-09T17:44:30+00:00

I have a stored procedure made in Oracle 9g that returns a cursor with

  • 0

I have a stored procedure made in Oracle 9g that returns a cursor with different columns depending on a parameter, its something like this:

CREATE OR REPLACE PROCEDURE ASCHEMA.SP_TWOCURSORS
(
    aParam NUMBER,
    P_RETURN OUT SYS_REFCURSOR
)
IS
BEGIN
    IF aParam = 1 THEN
        OPEN P_RETURN FOR
            SELECT
                a.column1, (number)
                a.column2  (varchar2)
            FROM
                table1 a;
    ELSE
        OPEN P_RETURN FOR
            SELECT
                b.column1, (varchar2)
                b.column2, (number)
                b.column3  (number)
            FROM
                table1 b;
    END IF;
END;

I have to consume this procedure in PowerBuilder and pass the returned data to a DataWindow1 or DataWindow2, depending on the returned cursor, these datawindows are filled in runtime by the execution of another procedures coming from other source. I can’t modify the database objects (like split the sp in two), just the PowerBuilder code. My problem is how to handle this scenario in an elegant way. I have some ideas but don’t know if it will work:

  1. Create a DataWindow object that handles every column involved in both cursors returned from the sp, then copy each row to the expected DataWindow.
  2. Create a DataStore and pass the sp with the Create method, then copy the rows in the expected DataWindow.
  3. Execute the procedure dynamically, fetch every row and add each result into a new row of the expected DataWindow.

I haven’t tried the first one because there are many columns and it will take a long time to do. The second looks good but I don’t know how to handle a DataStore with no DataWindow object and don’t know if this is possible (1). The third is my last option to solve this problem. I want to ask people before start implementing this solution because I’m new to PowerBuilder, and even if I won’t work on it too long I want to do it in the right way.

Thanks for the help.

(1) I have found this article about using Custom DataStores but I don’t know if I can use only 1 DataStore or I should use 2. Also, for the Oracle connection I don’t use SQLCA but another transaction object, so I don’t know how to do this.

  • 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-09T17:44:31+00:00Added an answer on June 9, 2026 at 5:44 pm

    Keep It Simple.

    You know the details of the stored proc. If you are calling this sp from PB, you are knowing its aParam already before the call. Why not defining 2 datawindows, one for each version of the results ?

    Each DW would have a retrieval argument (the one that is passed to the stored proc) and will get its result from the sp.

    At runtime, depending on the retrieval argument, and before retrieving the values, assign the corresponding dataobject to the datawindow object that is on : either the DW that suits the aParam = 1 or the DW that suits the else part.

    • 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 in oracle which is using cursor.Its fetching the data
I have a database stored procedure call that, among other columns, returns a column
I have a stored procedure that has the parameter: @desk VARCHAR(50) I want to
I have a stored procedure that returns a value, not a dataset, and I
Okay so I made some changes to a stored procedure that we have, and
I made a stored procedure which has the following parameter : @UserName Would that
I have a stored procedure that works fine on its own. A recent requirement
Using MS SQL Server .I have made a Stored Procedure named SP_Get_CallsLogged . I
I have a stored procedure which returns sys_refcursor and I am trying to fetch
I have a stored procedure (SP) in oracle: CREATE OR REPLACE PROCEDURE SP_SEL_LOGIN_INFO (

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.