My question is: What are the possible causes of an ORA-01001 for the following cursor? From what I've read, usually you get this error when you try to read an unopened cursor. I've had no luck reproducing the problem.
CODE
function GetPeripheralStatus(GuidID IN initiative.guid_identifier%type)
return initiative.status_flag%type is
sStatusString initiative.status_flag%type;
cursor PeripheralIndexRead is -- Peripheral Index tables
select 0 as Peripheral_Index --
from dual
where exists (select 1
from initiative i
where i.parent_guid_identifier = GuidID)
union
select 1 as Peripheral_Index
from dual
where exists (select 1
from attachment a
where a.owner_guid = GuidID)
union
select ct.PERIPHERAL_INDEX as Peripheral_Index
from COMMENT_TYPE ct
where ct.GUID_IDENTIFIER in
(select distinct (rc.COMMENT_TYPE_GUID_IDENTIFIER)
from RECORD_COMMENT rc
where OWNER_GUID = GuidID)
union
select lt.PERIPHERAL_INDEX as Peripheral_Index
from LIST_TYPE lt
where lt.GUID_IDENTIFIER in
(select distinct (li.LIST_TYPE_GUID_IDENTIFIER)
from LIST_ITEM li
inner join LIST_ITEM_OWNER_XREF lx on li.GUID_IDENTIFIER =
lx.GUID_IDENTIFIER
where lx.OWNER_GUID = GuidID);
begin
if GuidID is null
then
return null;
end if;
sStatusString := rpad('0',255,'0');
for recPeripheralIndexRead in PeripheralIndexRead -- loop through Peripheral Index records
loop
sStatusString := peak7.stuff(sStatusString,
recPeripheralIndexRead.Peripheral_Index + 1,
1,
'1');
end loop; -- recOpenRead in OpenRead
return sStatusString;
end GetPeripheralStatus;
return initiative.status_flag%type is
sStatusString initiative.status_flag%type;
cursor PeripheralIndexRead is -- Peripheral Index tables
select 0 as Peripheral_Index --
from dual
where exists (select 1
from initiative i
where i.parent_guid_identifier = GuidID)
union
select 1 as Peripheral_Index
from dual
where exists (select 1
from attachment a
where a.owner_guid = GuidID)
union
select ct.PERIPHERAL_INDEX as Peripheral_Index
from COMMENT_TYPE ct
where ct.GUID_IDENTIFIER in
(select distinct (rc.COMMENT_TYPE_GUID_IDENTIFIER)
from RECORD_COMMENT rc
where OWNER_GUID = GuidID)
union
select lt.PERIPHERAL_INDEX as Peripheral_Index
from LIST_TYPE lt
where lt.GUID_IDENTIFIER in
(select distinct (li.LIST_TYPE_GUID_IDENTIFIER)
from LIST_ITEM li
inner join LIST_ITEM_OWNER_XREF lx on li.GUID_IDENTIFIER =
lx.GUID_IDENTIFIER
where lx.OWNER_GUID = GuidID);
begin
if GuidID is null
then
return null;
end if;
sStatusString := rpad('0',255,'0');
for recPeripheralIndexRead in PeripheralIndexRead -- loop through Peripheral Index records
loop
sStatusString := peak7.stuff(sStatusString,
recPeripheralIndexRead.Peripheral_Index + 1,
1,
'1');
end loop; -- recOpenRead in OpenRead
return sStatusString;
end GetPeripheralStatus;
Thanks
Dean