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

Thread: query probelm for selecting right

  1. #1
    Join Date
    Aug 2008
    Posts
    123

    query probelm for selecting right

    Hi,

    i have oracle database on 9.2.0.6 and i am tring to do following:

    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
    Oct 2004
    Posts
    14
    Wouldn't

    Code:
    select testid,test_NAME, substr(testid,1,12) as New_ID from test.test_hrd
    where test_name like '%mc%'
    work?

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