Oracle SQL MAX function not returning max on VARCHAR to NUMBER conversion -


I am trying to get the highest system number from the set of rows from system number SYS First, the selection will be generated from table SYSTEM_ID , {SYS901, SYS87, SYS3024 .....}

this query I am trying to use:

select TABLE to MAX (REPLACE (SYSTEM_ID, 'SYS', ''))

possible The results are

{901,87,3024,20,1}

this 901 value where me 3024 I hope to see the value. I think the problem is that the field is a VARCHAR not a number . I do not know how to solve this problem.

  select maximum (TO_NUMBER (REPLACE (SYSTEM_ID, 'SYS', ''))) From the table;  

Use TO_NUMBER to convert VARCHAR2 to others Oracle compares the stars using its ASCII code ('9'> '3')

< / Div>

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -