-
problem cursor
Dear All,
Iam facing a small problem. IN the query below, the update statement in red is not working..... Iam pasting the query for the same condition on the table.
Kindly correct the mistake..
Regards,
K.Diwakar
DECLARE
CURSOR step3 IS
SELECT tblAgent.rowid rowidn,
tblAgent.tblAgent_AgentName agt_name,
tblAgent.tblAgent_AgentSSN agt_ssn,
tblAgent.tblAgent_Office agt_office,
tblAgent.tblAgent_DL agt_dl,
tblAgent.tblAgent_rsm agt_rsm,
tblrsm1.tblRSM_AgentSSN RSM_AgtSSN
FROM tblagent,
tblrsm1
WHERE tblRSM_Office = tblAgent_Office;
BEGIN
FOR c1_rec IN step3 LOOP
if c1_rec.AGT_NAME = c1_rec.AGT_RSM
AND c1_rec.AGT_SSN = c1_rec.RSM_AgtSSN then
update tblagent
set tblAgent_title='RSM'
WHERE rowid = c1_rec.rowidn ;
elsif c1_rec.AGT_NAME= c1_rec.AGT_DL THEN
update tblagent
set tblAgent_Title = 'DL'
WHERE rowid = c1_rec.rowidn ;
else
update tblagent
set tblAgent_Title = 'AGENT'
WHERE rowid = c1_rec.rowidn ;
end if;
end loop;
COMMIT;
END;
/
SQL> select count(*) from tblagent where tblAgent_Title = 'DL' ;
COUNT(*)
----------
0
SQL> select count(*) from tblagent where tblAgent.tblAgent_AgentName=tblAgent.tblAgent_DL;
COUNT(*)
----------
45
Last edited by diwakar; 11-18-2003 at 03:49 AM.
-
maybe the first if already "is true" and then next elsif is never done.
Andrej
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|