php - How to sort by numbers first with Oracle SQL query? -
i have table 'title' field varchar2 , want select rows , sort them first number , alphabet happens.
for instance, using simple order title
in end:
- abc
- def
- 321
but want this:
- 321
- abc
- def
the weird thing sql developer shows "right" order, numbers first. on app (php using oci8) shows numbers last.
not oracle expert, supposed able without altering session with
select * my_data sort nlssort(title,’nls_sort=binary_ai’)
where can change nls_sort=
fit needs (here list of values)
keep in mind docs says force table scan, might beneficial filter them first (but if selecting table scan going use anyway).
the reason why sql developer exhibits different behaviour because changes session.
Comments
Post a Comment