troubleshooting Question

Help with Oracle IF statment

Avatar of kalees
kaleesFlag for United Kingdom of Great Britain and Northern Ireland asked on
Oracle DatabaseSQL
5 Comments1 Solution147 ViewsLast Modified:
Hi All,

I am looking to extract a date from a notes box which will always appear after the # symbol. I have achieved this with the following line of code

SUBSTR (FINE_NOTES,(INSTR (FINE_NOTES, '#')+1)) AS "Received Date",

I am now attempting to take it one stage further to return NULL if the # symbol is not present as there is other text in the notes box which I do not require. I have tried with the following code but am getting errors and I am struggling to see the issue.

IF INSTR (FINE_NOTES, '#') THEN SUBSTR(INSTR (FINE_NOTES, '#')+1) ELSE NULL END IF) AS "Received Date",


Any help greatly appreciated,

Keith.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros