Max number in a Varchar column!


Well, to find the maximum number in a VARCHAR2 Column is bit tricky and we can find it in many ways. An example can be to find the maximum number in the Segment1 column in mtl_system_items_b table. Here is one of the best ways to find it:

select max(to_number(segment1))
FROM mtl_system_items_b
where regexp_like(segment1, '^-?[[:digit:],.]*$');
Advertisements