Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2003
    Posts
    29

    Unanswered: string manupilation

    hi !

    lets say I have varchar column with values like
    polname1
    polname2
    pol1234
    pol3456

    how can I seperate them based on the string after 'pol' ? I want to get all the names that have alphabets after the third position.

    thanks

  2. #2
    Join Date
    Jul 2003
    Location
    Near Paris France
    Posts
    60
    use substr function

  3. #3
    Join Date
    Jul 2003
    Location
    US
    Posts
    314
    Hi
    Use the following syntax.
    select substr(fname,4) from tablename where fname like 'pol%';

    Here 4 is the starting index. Here do make sure you consider the case where fname is just 'pol' or a string less than 3 characters.
    Thanx and Regards
    Aruneesh

  4. #4
    Join Date
    Jun 2003
    Posts
    29
    no what I meant is give me a querry that will give me polname1 and polname2 only ?

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

    select statement

    select fname from tablename where substr(fname,1,3) = 'pol';

  6. #6
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    I know how to do this in SQL Server (please hold the flames ;-)) It is

    select col1
    from table
    where col1 like 'pol[A-Za-z]%'

    It is a sort of regular expression in the like clause, but I can not find anything similar in Oracle's documentation. Does anyone know the syntax/supported status of this as far as Oracle is concerned?

Posting Permissions

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