0

I have the following SQL query using replace

SELECT 
            replace(
            replace(
            replace(
            replace(
            replace(email_text , 'This email is to notify you that for one or more records the Clearance has been Requested. Please follow the link below to go directly to this record.', '') 
              , ':', '</th>:<th>')  
              , '<BR/></th>','<BR/>') 
              , 'http</th>:<th>', 'http:') 
              , '</ul>', '</th></ul>') 
            INTO  v_result 
                FROM   record.notification  
                WHERE record_notification_id = p_recordnotification_id;

in above code I have

replace(email_text , 'This email is to notify you that for one or more records the Clearance has been Requested. Please follow the link below to go directly to this record.', '') 

Now instead I want to use like replace email_text with the sentence that starts with 'This email' and ends with 'this record.' instead of writing complete sentence . Please suggest.

1
  • 1
    Grah, why?! What are you actually trying to do here - get the plain text out of HTML? Commented Jul 9, 2014 at 7:15

1 Answer 1

2

Use regex:

regex_replace(email_text, 'This email.*this record[.]', '')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.