473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
6 3021
Pilgrim333
127 100+
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
Jibran
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
asp2
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
madankarmukta
308 256MB
@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
2,367 Expert 2GB
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
asp2
10
I haven't solved the problem I have overcomed it , by handing errors with :

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

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

Similar topics

2
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
0
by: Ed | last post by:
Hello, I posted a question about looping with Select in a While loop, a few days ago. Repliers to my post advised me that a Cursor would be much better (thanks all for your replies). I found...
6
by: Hareesh | last post by:
Hi, I am trying a Set Approach instead of Using of Cursor (which works). I am attaching the SQL to create tables and the my Procedure, and a piece of code to execute the Procedure. I would...
6
by: BlueDragon | last post by:
Grrr! I'm trying to run a script: print 'Declaring cursor' declare cInv cursor forward_only static for select distinct inv.company, inv.contact, inv.address1, inv.city,
10
by: Neil | last post by:
I need to get two values from a complex SQL statement which returns a single record and use those two values to update a single record in a table. In order to assign those two values to variables...
0
by: Mujdat Pakkan | last post by:
We have an interesting case where we want to use Postgres both as a database and a front end to a proprietary database. For the latter, we wrote functions that access the proprietary database. Then...
15
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
2
by: BilalGhazi | last post by:
Hi All, I have this strange problem. I am user of two different database (both are same version 9i). I created a procedure and within this procedure i used a cursor to select the values, this is...
80
by: xicloid | last post by:
I'm making a function that checks the input integer and returns the value if it is a prime number. If the integer is not a prime number, then the function should return nothing. Problem is, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.