Advertisement

08.05.2007 at 07:55AM PDT, ID: 22742820
[x]
Attachment Details

Stored Procedure Question

Asked by Weller0123 in Oracle Database

Tags: , ,

I need a way to track the version of a results set each time a stored procedure is run.  It returns about 2000 rows and I do have a sequence, but I'm having trouble.  

I need all rows to return the same number, then I need to incriment.  

I have to have this done today.  

Please help. Thanks in advance.

Here's the working code with no sequence involved:

CREATE OR REPLACE PROCEDURE FCG_LOAD_HA_EV_DATA
(P_JOB_RUN_ID    IN   NUMBER,
 P_JOB_USER_ID   IN   NUMBER)
 AS
tmpVar NUMBER;

BEGIN
DECLARE
CURSOR issueCursor IS
select t.prid object_id,
p.id project_id,
SUM(ROUND(PRJ_EFFORT_FCT(t.prid,'task','ACT'),2)) itd_actsum,
SUM(ROUND(PRJ_EFFORT_FCT(t.prid,'task','ETC'),2)) itd_estsum,
0 ptd_actsum,
0 ptd_estsum,
TRUNC(SYSDATE) EV_DATE,
to_char(sysdate,'IW') EV_WEEK,
to_char(next_day(sysdate,'SAT') - 7) START_DATE,
to_char(next_day(sysdate,'FRI')) FINISH_DATE

from  prtask t,
odf_ca_task ot,
srm_projects p,
fcg_ha_exec_groups xg,
fcg_ha_category_mapping map
where  t.prprojectid = p.id and
t.prid = ot.id and
p.id IN (SELECT sub_project_id from fcg_subprojects_v where master_project_id = '5053281') and
t.prid <> 5151720 and
ot.fcg_cat = map.category_id and
map.exec_id = xg.id and
map.is_active = 1 and
xg.is_active = 1
group by t.prid, p.id;    
iRow issueCursor%ROWTYPE;
BEGIN
OPEN issueCursor;
LOOP
FETCH issueCursor INTO iRow;
EXIT WHEN issueCursor%NOTFOUND;
INSERT INTO FCG_HA_EV_DATA
(object_id,
project_id,
itd_actsum,
itd_estsum,
ptd_actsum,
ptd_estsum,
EV_DATE,
EV_WEEK,
period_start_date,
period_end_date)
VALUES
(iRow.object_id,
iRow.project_id,
iRow.itd_actsum,
iRow.itd_estsum,
iRow.ptd_actsum,
iRow.ptd_estsum,
iRow.EV_DATE,
iRow.EV_WEEK,
iRow.START_DATE,
iRow.FINISH_DATE);  
END LOOP;
CLOSE issueCursor;



COMMIT WORK;

END;

END FCG_LOAD_HA_EV_DATA;

/Start Free Trial
[+][-]08.05.2007 at 08:25PM PDT, ID: 19636231

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2007 at 08:30PM PDT, ID: 19636248

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2007 at 09:49PM PDT, ID: 19636420

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Tags: procedure, stored, number
Sign Up Now!
Solution Provided By: StephenCairns
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628