Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Location
    Peoria, AZ
    Posts
    3

    Unanswered: Parsing Varchar2

    I need to parse out some alphabetic characters from a Varchar2 field to leave only the number values. The field values look like this $40-35 or say $40$35.

    Is there a sql function or statement to do this. Any help is greatly appreciated.

    andavian

  2. #2
    Join Date
    Jun 2003
    Posts
    34

    Re: Parsing Varchar2

    select to_number(substr(substr('$40-35' ,2),1,2)), to_number(substr(substr('$40-35' ,2),4,2)) from dual

    is your select statement to parse out your 2 dollar amounts.


    Originally posted by andavian
    I need to parse out some alphabetic characters from a Varchar2 field to leave only the number values. The field values look like this $40-35 or say $40$35.

    Is there a sql function or statement to do this. Any help is greatly appreciated.

    andavian

  3. #3
    Join Date
    Jan 2004
    Location
    India
    Posts
    62

    Question

    This will work only if the position of $ sign is fixed and the length of the string is fixed. Is it So?
    Regards,

    Rushi

  4. #4
    Join Date
    Jun 2003
    Posts
    34
    Yes, this is because you have given a fixed length variable and did not mention about how dynamic your VARCHAR would be. This assumes ur variable will be either ''$40-35" or "$40-35" which you have mentioned in your Question.
    Originally posted by Rushi
    This will work only if the position of $ sign is fixed and the length of the string is fixed. Is it So?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •