By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,985 Members | 1,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,985 IT Pros & Developers. It's quick & easy.

Cursor that is supposed to return one value Returns duplicated values of same row

P: 10
I have a cursor inside a program unit in Oracle Forms 6
and its supposed to get one row from this cursor ..
but in some values (only some and others not) it gets the same row twice (duplicated) in cursor's active set , I have checked on ROWNUM and it confirmed same row retrieval !!

I checked the table for duplicated values but it returned non , also the selected column is the primary key !!!!

DECLARE
CURSOR C IS
SELECT CRIME.CRIME_CODE
FROM CRIMES CRIME
WHERE yy=:yy
AND xx=:xx ;

BEGIN
OPEN C ;
FETCH C --
INTO number_type_variable ;

Close C;

Note that :
yy column contains ARABIC language data


I have solved the problem with some workaround , BUT I need to understand why this behaviour occurs ...

any one faced such problem before ??
Dec 14 '08 #1
Share this Question
Share on Google+
6 Replies


100+
P: 127
Hi,

Is this the exact code you are using? If not, then please post the exact code, otherwise it is just everyone's guess, cause there are a lot of things that can go wrong. If it is the exact code, I can't think of a reason why Oracle would return the same key twice (If it is returning the primary key)

Pilgrim.
Dec 14 '08 #2

P: 30
Try using DISTINCT with select like:

SELECT DISTINCT CRIME.CRIME_CODE
FROM CRIMES CRIME
WHERE yy=:yy
AND xx=:xx ;
Jan 11 '09 #3

P: 10
@Jibran
I had already done so ... same thing happens :)
N.B. crime_code is the table's primary key :D
Jan 11 '09 #4

100+
P: 293
@asp2

Hi,

I wonder "How there can be duplicate data in the table with the same primary Key ?"

There might be some manual mistake .Please remove that redundant data n your problem will be solved. :)

Thanks!
Jan 14 '09 #5

amitpatel66
Expert 100+
P: 2,367
Do some analysis by running your query in SQLPLUS and check why the duplicates are coming. Good that you have solved the problem. I ncase if you have made any change in your query or code then Do post the exact solution here that would help peoples around with the same problem.
THanks
Jan 15 '09 #6

P: 10
I haven't solved the problem I have overcomed it , by handing errors with :

cursor%NOTFOUND and sqlcode <> 0
Jan 26 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.