Question

How to sort by days of the week in Oracle 9i

Rating7.2Very Good

I'm running the following SQL statement:

SELECT last_name, hire_date, TO_CHAR(hire-date, 'fmDay') "Day"
FROM employees;

I need to sort (or ORDER BY) the day of the week (the column entitled "Day" above) starting with Monday.

I've tried a lot of different things, but nothing is working. Can I do this without having to creat a new table to give a numeric value to the day?

Thanks,
Tim

  1. Days of the week
    Hi, I've this table TAB_CTRL_DATE: CREATE TABLE TAB_CTRL_DATA ( ID_DATE VARCHAR2(64 BYTE), INPUT_DATA DATE ) I'd like to create a trigger that when I insert a new record into TAB_CTRL_DATA If INPUT_DATA in (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) then…
  2. Oracle Prodecure - different query for each day…
    Every day I run a manual query, at 7:41 pm. I have to customize the query each day. I would like to put the query into a procedure. The query I run compares today's data with a yesterday's snapshot and inserts the results into another table. Yesterday's snapshot is named for the day of the week: SNAPSHOT_THU, SNAPSHOT_FRI, etc. …
  3. Second Sorts in Oracle
    Is there a way to do additional sorting to the main sorting in an Oracle 10 query? That is, the first sort for a column, then sort another column but keep the original sort but for duplicate items do the second sort. Hope this isn't too confusing..
  4. select by week
    Hi all, I wish to modify this select in order to have the number of creation per week every Monday SELECT '09.09.00', COUNT(1) FROM TESTS WHERE create_date >= '09.09.00' and create_date < '06.10.06' and action = 'createFile'; Thanks Regards
  5. week of day problem
    hi guys, i am using to_number(to_char(sysdate,'D') ) to get the week of day but it runs depend on regional settings and if it is amrican it gives 2 and if it is english it gives 1 for monday. but i dont would like to be dependent on the regional settings. i would like to be independent. is there any function to return the week of day independent …

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
9i order to_char
Participating Experts
7
Solution Grade
B

Replies

 
by: Sys_Prog

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: tilacakr

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: tilacakr

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: izblank

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: pratikroy

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: ploubier

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: pratikroy

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: pratikroy

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by:

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: lilian-arnaud

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: tilacakr

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: pratikroy

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: pratikroy

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: ploubier

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: a_savage

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: anand_2000v

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: tilacakr

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

Know a thing or two about Oracle? Join our team of experts today.

    BrowseBecome an Expert