Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Run a query # of times in a given month?

Run a query # of times in a given month?

Run a query # of times in a given month?

Is there anything in Oracle that will help me solve this problem? I have a query that I have to run for every day in the current month. The query is here, and say, for the month of July, I'd have to run it 31 times since July has 31 days in it, but I can't put numbers in the where clause, because come September or February, I'll get an error saying couldn't run query for the 31st day, etc. anyone have any ideas? I'm trying to get it to output how many lines of data there are for each day in the month. Thanks

select count (*)
from sorted
where ddate = **Day1**;

select count (*)
from sorted
where ddate = **Day2** etc.

RE: Run a query # of times in a given month?


I don't know if you expect only one field as result of your query, see if this helps you:

Select count(*),ddate
from sorted
where to_char(ddate,'MMYYYY') = to_char(sysdate,'MMYYYY')
group by ddate;

this returns something like this:

--------- ---------
8875 01-JUN-99
7423 02-JUN-99
7620 04-JUN-99
7103 07-JUN-99
10372 08-JUN-99
7962 09-JUN-99

Good Luck

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close