Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2003
    Location
    US
    Posts
    314

    Unanswered: select ltrim ('88888',3) from dual;

    I have a question about doing a trim for first 3 letters of a phone number, so as to extract the area code for a customer.


    Is there any function like ltrim which I could possibly use, passing it the start index and end index along with the column name.

    Response would be much appreciated.
    Thanx and Regards
    Aruneesh

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Try:

    select substr('888-111-2222',1,3) from dual;

  3. #3
    Join Date
    Jul 2003
    Location
    US
    Posts
    314

    Just skipped my mind

    Hi L...DBA
    It just skipped my mind about the substr ....

    By the way, do u have a document, or any link where the oracle SQL functions are organized in order of functionality.

    I know getting a book as an option, but expensive too.
    Aruneesh

  4. #4
    Join Date
    Jul 2003
    Location
    US
    Posts
    314

    Valid zip codes

    Hi L...DBA
    I had one similar query.
    I am creating a list of area codes, and their correspoding zips.

    I want to avoid all the invalid zip codes, i mean nothing from Canada should appear. Meaning i just want to use the records which have a 5 digit number as the zip.

    Any quickies ?
    Thanx and Regards
    Aruneesh

  5. #5
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Try:

    If lenght(zip_code) = 5
    And ltrim(translate(zip_code,'0123456789','~'),'~') Is NULL
    Then .... 5 digit zip...
    Else ... invalid zip ...
    End If;

Posting Permissions

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