[Error Code:-259,SQL State:24000]Cursor not Open
Posted in 2013
Topics: Stored Procedures & SPL, Error Codes & Troubleshooting, Server Administration, Data Types & Schema Design, Java & JDBC Development
Hi,
I am executing a query which is using a function to return some value as input
to the query.
If i am executing the query on the local databases, it is working fine.
However, when i execute the same query in the distributed environment, then i
am getting the following error:
[Error Code: -259, SQL State: 24000] Cursor not open.
Please note that by distributed environment, I mean i am using the synonyms
for the other database instance.
Please also note that when I am executing the query using dbaccess, it works
fine but when the same query is being executed using java application, it
starts giving this error.
Can someone help me with any idea that how can i resolve the problem?
Here is the function code:
create function return_value(p1 varchar(10), p2 date) returning varchar(10);
--
define v1 varchar(10);
let v1 = 'AA';
foreach p_l for select trim(both from col1) into v1 from table1
where number = p1 and p2 between date1 and date2 and is_flag = 'Y' order by
date1 desc
return nvl(v1,trim(both from 'AA'));
end foreach;
return nvl(v1,trim(both from 'AA'));
--
end function;
Thanks in advance!
Original post:
Hi,
I am executing a query which is using a function to return some value as input
to the query.
If i am executing the query on the local databases, it is working fine.
However, when i execute the same query in the distributed environment, then i
am getting the following error:
[Error Code: -259, SQL State: 24000] Cursor not open.
Please note that by distributed environment, I mean i am using the synonyms
for the other database instance.
Please also note that when I am executing the query using dbaccess, it works
fine but when the same query is being executed using java application, it
starts giving this error.
Can someone help me with any idea that how can i resolve the problem?
Here is the function code:
create function return_value(p1 varchar(10), p2 date) returning varchar(10);
--
define v1 varchar(10);
let v1 = 'AA';
foreach p_l for select trim(both from col1) into v1 from table1
where number = p1 and p2 between date1 and date2 and is_flag = 'Y' order by
date1 desc
return nvl(v1,trim(both from 'AA'));
end foreach;
return nvl(v1,trim(both from 'AA'));
Response:
Well if your foreach loop is going to process multiple rows, I would think you
would want the to use the return "with resume" option...but I'm not sure if
your foreach statement should/would be processing multiple rows or not.