MySQL Forums
Forum List  »  Stored Procedures

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

> if b.title_sci=b.title, then we get cc=0

get it, or set it? If the former, what guarantees that the rule is followed?

> if b.title_sci<>b.title then we have to see the master

That contradicts what you wrote before: if base.title_sci = base.title or b.issn1=b.issn2 or b.issn=b.eissn then this is match and CC=0 else cc=1. Which is correct?

> if in master this m.title_sci is dog and for the same row m.title= cat

Loose language yields errors. Especially when writing specs, be literal. Do you mean: if m.title_sci <> m.title?

> then this is match as per the master(a way we say this is match
> though the colun doesnt match in base table )
> .Hence i need to update cc for this row in the base table to zero which indicates this is a match.

You seem to mean to say this is a condition for (i) setting b.cc=0 and (ii) consulting the corresponding master row. Is that correct?

You've given apparently inconsistent variants of the condition for setting b.cc=0 and updating the master version of the row. We're writing pseudocode for a requirement. It needs to be unambiguous. Here's your requirement as I understand it so far, unresolved issues I've so far identified are in comments:

in a join of b to m on (title_sci, title, issn1, issn2, issn, eissn, databas) ...

if b.title_sci=b.title or b.issn1=b.issn2 or b.issn=b.eissn then 
  set b.cc=0                   -- WHAT IF B.CC=1?
  if m.cc=0 then
    ???                        -- YOU SAID SET b,cc=0 BUT IT ALREADY IS 
  else if m.title <> m.title_sci
    set .cc=0                  -- OR M.CC?
  end if
else
  set b.cc=1
end if

For readability & clarity, please put your corrected spec, in a format like the above, inside a pair of BBCode code tags (the 1st tag is the word "code", the 2nd is "/code", each surrounded by square brackets).



Edited 1 time(s). Last edit at 09/25/2017 07:53PM by Peter Brawley.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Display all the records from table using cursor
667
September 25, 2017 03:51PM


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.