Group by hour in Oracle

problem

When put in a chart don't show all hours from day. I made a table from 1 to 24

solution

I found a simple method like this

  SELECT LEVEL - 1 AS time_hour
  FROM dual
  CONNECT BY LEVEL <= 24
Gravatar
Author: Dumitru Maros
Last Edit: July 3, 2024
1 Thanks received

1 Comment


Thanks for your contribution!

I made two tiny edits, one was to set the language for the code, for slightly better syntax highlighting:

```sql

The other one was to edit the tags from "Oracle, SQL" to "Oracle,SQL", without the space, as it was saving the tag with a space in front. This is actually kind of a bug, which I'll fix shortly.

Gravatar
Dan Dumitru
Jul 3, 2024 at 07:44

Last Edit July 3, 2024
Created July 2, 2024
Tags
Oracle
SQL

Pay it forward!

Did this solution help you?
You can pay it forward and write a solution here yourself, when you have one, helping future Googlers like you... >> read more

Your Comment

Feel free to post additional info or improvement suggestions.
preview
Optional, never shown, displays gravatar.

Formatting Tips

This editor uses Markdown to easily add code in your posts.

Triple backticks for full line(s) of code (or indent 4 spaces)

```
let foo = 'bar';
```

[link text](http://a.com)

*italic* **bold**

More Tips