How do I fetch the Max value of the data stored in a NVARCHAR column. Presently only numbers are stored in this column.
Max(AliasID) is not returning me the collect value.
Is there a way to fetch these numberic values from NVARCHAR col?
Now don't ask me why it was implemented that way...its an already existing system.
posted 5 years ago
You seem certain that they are all numbers in the column. You can use to_number() function
to convert to numbers and get the max .
If by chance one is not a number , it will throw an invalid number error.
You might consider writing a small function to convert to a number and if it is
invalid number return a null or 0 ?