1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Need logic to compare strings stored in a table reg.

Discussion in 'SQL PL/SQL' started by laxman, Jul 15, 2010.

  1. laxman

    laxman Forum Expert

    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    230
    Location:
    MUMBAI
    Hi all,
    I need a solution of this requirement.
    i have Table reqtab

    Code (SQL):
    sql>SELECT * FROM reqtab;

    REID                               EMAILADDRESS
    ---------------------- ---------        -------------
    72                                   [email]a@abc.com[/email]
    72                                   [email]b@eabc.com[/email]
    75                                   [email]c@abc.com[/email]
    75                                   [email]a@abc.com[/email]
    now the requirement is:
    ---> i have to create a procedure which should takes 72, 75 as in parameter
    and these procedure should compare emailaddress of 72, 75 and if this emailaddresses are not matching ,should update with unique mailids
    for 72

    i need the table should be updated in the following way

    result should be

    Code (SQL):
    REID                                   EMAILADDRESS
    ---------------------- ---------        -------------
    72                                   [email]a@abc.com[/email]
    72                                   [email]b@eabc.com[/email]
    72                                   [email]c@abc.com[/email]
    Thanks n Regards
    Laxman
     
  2. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Requirement is not clear.

    1. What to do in case 72 or 75 is having multiple email addresses?
    2. On what basis ReqId is Updated ?
    3. What happens to a@eabc against Reqid 75 ?