troubleshooting Question

Reference datasets inside PL/SQL cursor and dumping queried datasets

Avatar of LuckyLucks
LuckyLucks asked on
* PL/SQLOracle Database
3 Comments3 Solutions190 ViewsLast Modified:
Hi:

  I need to reference a dataset inside a cursor and pick a date value from the dataset and use it as a parameter to another query. I can not create temp tables but was wondering if I can pre-place my dataset in some in-memory or data structure  to be searched later in my PL/SQL cursor stub?

My dataset is:

select PMO, Projects, PMName, designatedDate from PMOdesignations;  -- Dataset D1
 

And if you look for the <<<< in the PL/SQL block below that is how I want to use this dataset.

DECLARE
    cntpm   INTEGER;

    CURSOR c1
    IS
        SELECT DISTINCT proj_code
          FROM all_projects_plan;
BEGIN
    DBMS_OUTPUT.enable;

    FOR item IN c1
    LOOP
        SELECT COUNT(DISTINCT pm)
          INTO cntpm
          FROM mytable
         WHERE pmloc = 'NA' AND p_code = item.proj_code;

        IF cntpm > 1
        THEN
            DBMS_OUTPUT.put_line('Several Project managers');

     /* Put all projects under cursor proj_code into a some sort of table */

              select * from all_PM_activities where project = proj_code;  <<<< T1

         
    /* Pick the designationDate from the Dataset1 and pick out the activities in T1 that are between that designatedDate  given D1.pm = T1.pm */

     

         
        ELSE
            DBMS_OUTPUT.put_line('just one project manager');
        END IF;
    END LOOP;
END;
ASKER CERTIFIED SOLUTION
johnsone
Senior Oracle DBA

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 3 Answers and 3 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 3 Answers and 3 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004