DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: to_number

  1. #1
    Join Date
    Sep 2002
    Posts
    20
    hello all,
    I need to concatinate 28||'-'||column1 where column1 is number datatype. The value after contination should appear 28-60 where 60 is the value present in column1.
    How do I do that? 28 is static value.


    select '28-'||column1 into temp from table1;--it didn't work

    select to_number('28-')||column1 into temp from table1;--this didn't work either.

    any help.

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    Are you sure you don't want TO_CHAR('28')||'-'||column1?
    Or even '28-'||column1. By adding the - you are making a char or a varchar2.

  3. #3
    Join Date
    Sep 2002
    Posts
    20
    I tried doing that but it won't accept to_cahr function it says "too many declarations of to_char match this call"

    I want to continate 28-||some number value.

  4. #4
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    '28-'||LTRIM(TO_CHAR(column1))
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  5. #5
    Join Date
    Sep 2002
    Posts
    20
    How can I convert Varchar2 datatype to Number datatype.
    I need to get a max value for a colun whose datatype is varchar but has numbers in it.

  6. #6
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    First - why would you possibly use a VARCHAR2 field to store numbers?

    Regardless, simply do MAX(TO_NUMBER(field)). Of course, this will break if you have any non-numeric data in the field. There are other solutions on this forum to handle that, but I'm too lazy to look for them.

    - Chris
    Christopher R. Long
    ChrisRLong@HotMail.Com
    But that's just my opinion. I could be wrong

Posting Permissions

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


Click Here to Expand Forum to Full Width