I am having a table name x which contain week-no where datatype of week number is varchar2 which fetches max(week-no) in 22 second. I need to fetch row with max week-no I tried this below query:
select max(to_number(week-no))
from x;
please help and suggest the query which can take less time.
First, create a functional index:
I think Oracle should be smart enough to use the index for your query. If not, you can try:
I should also point out that if you are storing the number as a character string, then you should pad it with zeros (so "01", "02" and so on). In that case, you can just use
max(week_no)
and an index directly on the column.