Link to home
Start Free TrialLog in
Avatar of bschave2
bschave2

asked on

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
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

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;

ASKER CERTIFIED SOLUTION
Avatar of awking00
awking00
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bschave2

ASKER

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
>>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?
each row is an hour.
Again, and?  I got that part.

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

The accepted answer uses the join and SQL mentioned in my post.