Re: INSTR challenge
From: Brian West <bwest_at_casetech.net>
Date: Thu, 22 Feb 2001 13:05:01 GMT
Message-ID: <188l6.150$Eu2.13895_at_newsread1.prod.itd.earthlink.net>
>
> I have a character field that holds something like
> this:
>
> 12345,678,123
>
> The comma is like a delimeter.
>
> So, ultimately I'd like to pull out
>
> 12345 and 678 and 123
>
> I know INSTR will return the location of the commas and
> I could use sustr to help, but how do I get all 3 numbers
> to be pulled out?
>
> Thanks,
> Jen
Received on Thu Feb 22 2001 - 14:05:01 CET
Date: Thu, 22 Feb 2001 13:05:01 GMT
Message-ID: <188l6.150$Eu2.13895_at_newsread1.prod.itd.earthlink.net>
Adjust for what you wan the nubers to do. Assumes string is i nthe format you specified.
PROCEDURE PARSE_NUMS(pi_num2 IN VARCHAR2)
IS
v_comma_pos NUMBER := INSTR(pi_num,',');
BEGIN
- no more commas, at last number IF v_comma_pos = 0 THEN DBMS_OUTPUT.PUT_LINE(pi_num);
- remainder of string ELSE DBMS_OUTPUT.PUT_LINE(SUBSTR(pi_num,1,v_comma_pos - 1)); PARSE_NUMS(SUBSTR(pi_num,v_comma_pos + 1)); END IF; END;
>
> I have a character field that holds something like
> this:
>
> 12345,678,123
>
> The comma is like a delimeter.
>
> So, ultimately I'd like to pull out
>
> 12345 and 678 and 123
>
> I know INSTR will return the location of the commas and
> I could use sustr to help, but how do I get all 3 numbers
> to be pulled out?
>
> Thanks,
> Jen
Received on Thu Feb 22 2001 - 14:05:01 CET