We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Extracting tokens from a string using substr function.

gram77
gram77 asked
on
Medium Priority
737 Views
Last Modified: 2013-12-07
Tokens come within #..#, and are not fixed, could be any number.

Program should extract tokens one by one and assign it into variable.
Comment
Watch Question

Author

Commented:

sample string
This report is ran on #sysdate#, The report is run on #as_of_dt#. Report is written on file #name#

Commented:
Assuming name adn as_of_dt are variables
select regexp_replace( regexp_replace(regexp_replace('This report is ran on #sysdate#, The report is run on #as_of_dt#. Report is written on file #name#','#sysdate#', sysdate),
                                                                     '#name#', name),
                                  '#as_of_dt#',as_of_dt) from dual

If as_of_dt,name are column name then replace dual with table name.
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.