-
How to extract part of a string
I need to isolate part of a string called addnl_info that is type varchar (255). I can use the INSTR, SUBSTR, and LTRIM functions to isolate certain parts of the string. But I can't isolate the first part that I need.
The string looks like this: "from status WC-Wait Customer to status AR-Analyst Research". I can isolate the last part "AR-Analyst Research". But I can't isolate the first part, "WC-Wait Customer".
I can eliminate the "from status" by using:
LTRIM(addnl_info, 'from status '
This gives me "WC-Wait Customer to status AR-Analyst Research".
INSTR will give me the number of the second space where I want it to separate:
INSTR(addnl_info,' ',1,2)
But RTRIM(addnl_info, INSTR(addnl_info,' ',1,2)) or SUBSTR(addnl_info, INSTR(addnl_info,' ',1,2)) only leave me with what I don't want. I need to be able to say "Take this away and leave me what's left."
I know there must be a simple way to do this.
Anyone have the answer?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|