how to create hour rows in oracle select statement with no data

I have a task of pulling data based on the date. If this data does not exists, I need to be able to return 24 blank records. I am doing this for a asp.net gridview. it should look like this, but the contract id I will be passing in via input parameter

hour     contract id     mw     additional mw     date_time
1           119                
2           119
3           119
4           119
4           119
bschave2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Just do an outer join on the following as an inline view.

This generates a list form 1 to 24:
select level from dual connect by level<=24;

0
awking00Information Technology SpecialistCommented:
See attached.
query.txt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bschave2Author Commented:
this is what I am trying to do. I would like to get three products side by side so that I can create a gridview to edit the data.
option-availability.jpg
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

slightwv (䄆 Netminder) Commented:
>>this is what I am trying to do.

and?  Does the query posted in http:#a35375597 using the select I posted in http:#a35369643 not return the correct rows?

Anyway:  Can't you just build the gridview with 24 rows?
0
bschave2Author Commented:
each row is an hour.
0
slightwv (䄆 Netminder) Commented:
Again, and?  I got that part.

The query provided by awking00 should generate 24 rows.  Does it not do that?
0
bschave2Author Commented:
my question was based on if there was no data and so it doesn't work unless you have data.
0
bschave2Author Commented:
nevermind. I just replaced the t.date_time with sysdate. thanks for the help.
0
slightwv (䄆 Netminder) Commented:
Might I ask why you didn't split points?  

The accepted answer uses the join and SQL mentioned in my post.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.