title: How to replace domain name of all email
body: <p>I am trying to replace the ending of any email with a specific email domain.The procedure will be passed two strings: First is the original domain name that is to be replaced; and Second the new domain name that will be replacing the original (in that order). For example, if the procedure is passed the strings "sadme.com” and "happyme.com", every e-mail in the database with "sadme.com" as their domain name will be changed to "happyme.com" as their domain name</p>
  
  <p>Examples:</p>
  
  <pre><code>Before                     After
  -------------------------- ---------------------------
  ExampleEmail@yahoo.com     ExampleEmail@gmail.com
  SecondExample@hotmail.com  SecondExample@gmail.com
  </code></pre>
  
  <p>This is what i have but im getting an error</p>
  
  <pre><code>          Create Procedure PR_Q3
      (P_OldDomain Varchar2,P_NewDomain Varchar2)
      As
        Cursor C_Domains IS Select Email_Address
  
  
         From Broker 
                       where Email_Address =  '%@'||P_OldDomain;
                 V_OldDomain Varchar2(50);       
            Begin
            Open C_Domains;
            Fetch C_Domains INTO V_OldDomain;
            While C_Domains%Found loop
                  if C_Domains = '%@'||P_OldDomain Then
                      Update Broker
                      Set Email_Address = P_NewDomain
                      Where Email_Address = V_OldDomain;
                End if;      
            Fetch C_Domains into P_NewDomain;
            End Loop;
    Close C_Domains;
  End PR_Q3;
  /
  Show Errors;
  </code></pre>
  
  <p>im getting the errors:</p>
  
  <p>LINE/COL ERROR</p>
  
  <hr>
  
  <p>2/29     PLS-00103: Encountered the symbol "(" when expecting one of the following:</p>
  
  <pre><code>     := . ) , @ % default character
       The symbol ":=" was substituted for "(" to continue.
  </code></pre>
  
  <p>2/61     PLS-00103: Encountered the symbol "(" when expecting one of the following:</p>
  
  <pre><code>     := . ) , @ % default character
       The symbol ":=" was substituted for "(" to continue.
  </code></pre>
  
  <p>Also i tried taking out the varchar2(50) and just put Varchar2 and it gives me error:</p>
  
  <pre><code> PLS-00403: expression 'P_NewDomain' cannot be used as an INTO-target of a SELECT/FETCH statement
  </code></pre>
  
  <p>Thanks!</p>