Home » SQL & PL/SQL » SQL & PL/SQL » selecting 12 char (oracle 9.2.0.6)
selecting 12 char [message #394525] Fri, 27 March 2009 11:55 Go to next message
patdev
Messages: 74
Registered: August 2008
Member
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?
Re: selecting 12 char [message #394526 is a reply to message #394525] Fri, 27 March 2009 11:57 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>how can i do that?
SUBSTR(TESTID,1,12)
Previous Topic: Problem Using table name in PLSQL fetched from cursor (merged)
Next Topic: difference between dropping and unusable index
Goto Forum:
  


Current Time: Sun Feb 16 00:08:31 CST 2025