Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Posts
    53

    Unanswered: selecting 12 char

    Hi,

    i have oracle database on 9.2.0.6 and i am tring to do following:
    I am trying to selecting the testid(varchar2(20)) and cast(testid as varchar(12)) but i get both column in result same rather than 12345678912100 and need 123456789121


    select testid,test_NAME, cast(testid as varchar(12)) as New_ID from test.test_hrd
    where test_name like '%mc%'

    i get return but both new_ID and testid are same, the testid is 14 character and i need to select 12 in new column?

    how can i do that?

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    select substr(testid,1,12) from my_table;
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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