MySQL Forums
Forum List  »  Stored Procedures

Re: Display all the records from table using cursor
Posted by: Peter Brawley
Date: September 25, 2017 01:18PM

No primary key, yikes. A table without a PK isn't a real table.

A candidate key is a column or set of them uniquely identifying all rows. "Candidate" means "candidate to be primary key".

The logic is inescapable. If there's no PK and no candidate key, updates cannot be guaranteed. Period.

You can waste as many hours as you like trying to square that circle, you will not succeed.

Your requirement suggests that if the tables do have a candidate key, it's so complex that it will slow updates to a crawl. Which is when auto_increment is essential. So why haven't these tables been given PKs, and in any case what stops you from adding auto_increment PKs for this job?

Let's see the result of Show Create Table for one of these tables, along with, say, five sample rows of data, so I can analyse the update requirement.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Display all the records from table using cursor
681
September 25, 2017 01:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.