Create list dates for spefic month

I need to create function which i send two parameteres frist  for year (2013) and second prameter for month (09)
to out list dates for this month

You can do it with SQL like this...
SQL> ed
Wrote file afiedt.buf
  1  with t as (select 2013 as yr, 9 as mn from dual)
  2  --
  3  select trunc(to_date(to_char(mn)||'/'||to_char(yr),'mm/yyyy'),'mm')+level-1 as dt
  4  from   t
  5* connect by level <= extract(day from last_day(to_date(to_char(mn)||'/'||to_char(yr),'mm/yyyy')))
SQL> /
DT
01-SEP-2013 00:00:00
02-SEP-2013 00:00:00
03-SEP-2013 00:00:00
04-SEP-2013 00:00:00
05-SEP-2013 00:00:00
06-SEP-2013 00:00:00
07-SEP-2013 00:00:00
08-SEP-2013 00:00:00
09-SEP-2013 00:00:00
10-SEP-2013 00:00:00
11-SEP-2013 00:00:00
12-SEP-2013 00:00:00
13-SEP-2013 00:00:00
14-SEP-2013 00:00:00
15-SEP-2013 00:00:00
16-SEP-2013 00:00:00
17-SEP-2013 00:00:00
18-SEP-2013 00:00:00
19-SEP-2013 00:00:00
20-SEP-2013 00:00:00
21-SEP-2013 00:00:00
22-SEP-2013 00:00:00
23-SEP-2013 00:00:00
24-SEP-2013 00:00:00
25-SEP-2013 00:00:00
26-SEP-2013 00:00:00
27-SEP-2013 00:00:00
28-SEP-2013 00:00:00
29-SEP-2013 00:00:00
30-SEP-2013 00:00:00
30 rows selected.
So turning that into a function is easy enough

Similar Messages

  • Min date for each month from list

    Hi all,
    I need to select only minimal date for each month from this sample query:
    select date '2011-01-04' as adate from dual union all
    select date '2011-01-05' as adate from dual union all
    select date '2011-01-06' as adate from dual union all
    select date '2011-02-01' as adate from dual union all
    select date '2011-02-02' as adate from dual union all
    select date '2011-02-03' as adate from dual union all
    select date '2011-10-03' as adate from dual union all
    select date '2011-10-04' as adate from dual union all
    select date '2011-10-05' as adate from dual So the result should be:
    04.01.2011
    01.02.2011
    03.10.2011How do I perform it?

    WITH dates
         AS (SELECT DATE '2011-01-04' AS adate FROM DUAL
             UNION ALL
             SELECT DATE '2011-01-05' AS adate FROM DUAL
             UNION ALL
             SELECT DATE '2011-01-06' AS adate FROM DUAL
             UNION ALL
             SELECT DATE '2011-02-01' AS adate FROM DUAL
             UNION ALL
             SELECT DATE '2011-02-02' AS adate FROM DUAL
             UNION ALL
             SELECT DATE '2011-02-03' AS adate FROM DUAL
             UNION ALL
             SELECT DATE '2011-10-03' AS adate FROM DUAL
             UNION ALL
             SELECT DATE '2011-10-04' AS adate FROM DUAL
             UNION ALL
             SELECT DATE '2011-10-05' AS adate FROM DUAL)
    SELECT TO_CHAR (MIN (adate), 'DD.MM.YYYY') adate
      FROM dates
      GROUP BY to_char(adate, 'YYYY.MM')
    ADATE
    03.10.2011
    01.02.2011
    04.01.2011

  • Creating test data for a problem

    Hi,
    I've been using this forum for a few months and it has been extremely useful. The problem is that I actually have no idea how to create test data for a specific problem. I've tried googling but to no avail. I have had other users create test data for some of my problems using a 'WITH' statement but it would be great if someone could explain the logic behind it and how to approach a specific problem where in the query I use multiple tables.
    I know it's probably a stupid question and I'm relatively new to sql but it would help a lot if I understood the process.
    Banner:
    Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE 11.2.0.2.0 Production"
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    Look at the point 3 and 4. You can also follow other points too.
    Please consider the following when you post a question. This would help us help you better
    1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
    You can use the following query and do a copy past of the output.
    select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
    that are asked the answer is already there.
    3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
    I have the following table called sales
    with sales
    as
          select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
          union all
          select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
    select *
      from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
    For example in the above sales table, I want to know the total quantity and number of invoice for each product.
    The output should look like this
    Prod_id   sum_qty   count_inv
    1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
    6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
    Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
    use the {noformat}{noformat} tags.
    The usage of the tag is like this.
    <place your code here>\
    7. If you are posting a *Performance Related Question*. Please read
       {thread:id=501834} and {thread:id=863295}.
       Following those guide will be very helpful.
    8. Please keep in mind that this is a public forum. Here No question is URGENT.
       So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How should restrict data for particular month?

    Hi Experts,
    How should retrieve data for particular month without where condition.

    Hi,
    You must be having Month Object right in your Webi?
    User will be given opportunity to Select his/her required [Month]
    Create variable as =Userresponse("Enter value for Month")same text as you are giving in the Prompt text....Name it as [UMonth]
    Go to analysis tab..Filter..Add filter...[Month]=[UMonth]
    always this report will run for the month user require

  • Have family plan with 250 data which I almost use each month.  Going on vacation and will be on the road for two weeks.  Should I up my data for a month then change back.  Is it worth it or should I just run over and pay the extra 15 per gig?

    have family plan with 250 data which I almost use each month.  Going on vacation and will be on the road for two weeks.  Should I up my data for a month then change back.  Is it worth it or should I just run over and pay the extra 15 per gig?

    Hello mlazaretti. Vacation time is awesome. (Especially a road trip!) Since you will be going out for two weeks, you never know if having extra data may come in handy. I highly recommend switching to the next tier up so this way you have more data. This way it is only $10.00 more versus $15.00, and you dont have to worry about overages. Then change back at the start of the next billing cycle.
    If you need help making this change let us know! Have a safe trip!
    NicandroN_VZW
    Follow us on twitter @VZWSupport

  • User Profile Data for One Month in ST03N

    Dear All,
    I have one question for a similar requirement.
    I want to see the User Profile data for last month (e.g.August)
    I navigate through the same path as described by you.
    ST03N- Expert Mode- Total (select period)-- User Profile (from analysis view)
    even though I have selected One month period (August) ; I could see only the data for one week (1st August to 7th August)
    Can you please advice how can I solve my purpose, if not this time but may be in future I should be able to see complete one month data.
    Thanks in advance.
    Best Regards,
    Jayesh

    Dear Shailesh,
    Thanks for the very prompt and accurate response.
    However we have this job scheduled on monthly basis in our productive system, still there is no data avaialable.
    Kindly advice.
    Best Regards,
    Jayesh

  • Can i add data for current month only

    can I add data for current month only?

        Knowing your plan options is important marlingut! So that we are able to provide correct information, what make and model phone are you trying to add data too? Is this device already activated on your account?
    Thank You,
    MichelleL_VZW
    VZW Support
    Follow us on Twitter @VZWSUPPORT

  • Anyone else getting a message that they have almost used all of their data for the month?

    We just got a message saying that we have used 90% of our data for the month and we are only 10 days into the billing cycle. I looked at our account on line and it says that we aren't even close to using our total data for the month. When does all of the stupid stuff stop? When I switched to Verizon 10 years ago, they were great. Great customer service, great plans, etc. Now that has gone away. The 4G service is an absolute joke. Where I used to have great service, there literally is none, and the phone won't even switch to 3G if it is in a bad area. I travel through a major city every day and I am amazed at how crappy the service is.
    Now I'm getting messages that aren't even correct??? I have a lot of lines on my account and I don't want to go elsewhere, especially since I live in the country and Verizon is the only way to get decent internet service, but this is getting rediculous. I guess listening to the customers doesn't matter anymore as long as they get their money.

        Hi GeoffPrice
    I'm sorry to hear your getting alerts that are incorrect. Let's get to the bottom of this. What zip code are you in? Are any other devices having the same issue on your account?
    JoeL_VZW
    Follow us on Twitter @VZWSupport

  • Generate all the dates for given month

    Hi all,
    How can I generate all the dates for given month? For example If I give Feb-2008 then it should display all the dates from 01/02/2008 to 29/02/2007
    Thanks,
    Sujnan

    This question was expanded (and answered) at
    Monthly Report
    You can also search for "all days in month".

  • MDX to dynamically create period to date for each month of current year

    I need some help with MDX. I am not even sure if this is possible to do but here is what I need.  Any help is greatly appreciated.
    I have a Date dimension with a hierarchy defined as Year-Qtr-Month-Date
    I have a measure called Rentals
    Assume the current date is 10/24/2014.  I want to display by month for the year 2014, the sum of rentals equivalent to the current MTD.  So January would sum 1/1 thru 1/24.  February would sum 2/1 thru 2/24.  March would sum 3/1 thru
    3/24, etc.
    On the end of the current month, all months would display the sum of the whole month. I am not concerned if a month ends on the 30th or 31st.  The end is end.
    It needs to be dynamic enough so that if the current date is the 27th, each month would sum from the 1st to the 27th.

    Hi Rocko,
    According to your description, you want to compare the sum amount of rentals for each month, right?
    In MDX, we can use
    PARALLELPERIOD function returns a member from a prior period in the same relative position as a specified member. So you can use the query like
    with set Period as {[Arrival Date].[Date].[Month].&[2014]&[1]:[Arrival Date].[Date].[Month].&[2014]&[27]}
    member [Arrival Date].[Date].[0] as sum({Period})
    member [Total Amount N-1] as (PARALLELPERIOD([Arrival Date].[Date].[Month], 1, [Arrival Date].[Date].[Year].&[11]), [Measures].[Total Amount])
    Here is a sample query on AdventureWorks cube.
    SELECT ParallelPeriod ([Date].[Calendar].[Calendar Semester]
    , 3
    , [Date].[Calendar].[Month].[October 2003])
    ON 0
    FROM [Adventure Works]
    Regads,
    Charlie Liao
    TechNet Community Support

  • Getting the data for last month of every year

    Hi,
           How to declare the date if we want to pull the data from the December of every year.
    For example if the query is run in march 2015 and they want the historical data it should pull only the data from dec 2014.
    In the same way if they ran the query in future jun 2016 and if they want to historical data it should pull only data from dec 2015.
    It should not coded manually. Please help me with date format that need to used.
    BALUSUSRIHARSHA

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    A table has to have a key to be table.  Here is my guess at a repair job: 
    CREATE TABLE Test_Data
    (pu_id INTEGER NOT NULL
      REFERENCES PU(pu_id),
     pu_date DATE DEFAULT CURRENT_TIMESTAMP NOT NULL,
     PRIMARY KEY (pu_id, pu_date),
     x_count INTEGER,
     y_count INTEGER);
    Identifiers are not numeric in a good schema. What math do you do with them? They are also the key in the table that models the entity they identify. Where is the PU table (and what is a PU anyway)? 
    INSERT INTO Test_Data
    VALUES
    (28, '2014-01-01', 10, 20), -- crap! No key in this mess!! 
    (28, '2015-01-01', 30, 20), -- 
    (28, '2014-12-12', 10, 20), 
    (28, '2015-02-02', 10, 20);
    A PIVOT is not a query and not even part of SQL. It is how Microsoft programmers who do not know RDBMS or have a report writer violate the tiered architecture of SQL. We also do not use XML mixed in SQL. It is a bitch to maintain, has poor performance and again
    violates the tiered architecture principle. 
    A query is not sorted because it is a table. A file in COBOL can be sorted and that seems to be what you really want to write. 
    Old COBOL love the Sybase CONVERT() string function to avoid SQL temporal data. 
    We never use SELECT * in production code; Google it. Not only are you generating code, you are generation bad code. 
    Since SQL is a database language, we prefer to do look ups and not calculations. They can be optimized while temporal math messes up optimization. A useful idiom is a report period calendar that everyone uses so there is no way to get disagreements in the DML.
    The report period table gives a name to a range of dates that is common to the entire enterprise. 
    CREATE TABLE Month_Periods
    (month_name CHAR(10) NOT NULL PRIMARY KEY
       CHECK (month_name LIKE <pattern>),
     month_start_date DATE NOT NULL,
     month_end_date DATE NOT NULL,
      CONSTRAINT date_ordering
        CHECK (month_start_date <= month_end_date),
    etc);
    These report periods can overlap or have gaps. I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601
    data format required by Standard SQL and it is language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
    This will port and waste time calling string function row by row. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • SAP XI runtime workbench doesnot display data for previous months

    Hi,
    We are experiencing an issue in our XI system. When we try to extract messages from the Integration engine we recieve data only for two months including the present month and not for previous months.
    Can you pleaes suggest which SAP job or any set parameter is creating such a scenario.
    Thanks in advance and suggestion are welcome.
    Regards,
    Subhram

    You should check the archiving/deletion jobs in the PI Admin Check guide..
    Kind regards,
    Mark

  • Delete DSO data for current month on a daily basis.

    Hi Gurus,
    We have a requirement where we have to delete the data in the BW DSO's for the Current Month every day before loading data into it. The reason for this is that in R3 they delete data for the current month in addition to adding new records and changing existing records. Since we do a Full load in BW, the deleted records in R3 will still exist in the BW DSO, hence the need for deletion.
    We can't delete ALL the data in the DSO as we use the BW DSO for Archiving purpose and the R3 table at any point of time will have just 3 months of data, while BW will have historical data.
    I know there is a process to delete DSO contents in the Process Chain, but can it be set up to just delete the current months data??
    Thanks
    Arvind

    Hi Arvind,
    The program RSDRD_DELETE_FACTS or transaction DELETE_FACTS will help you in deleting the records. Execute the program and select the option 'Generate Selection Program'. It will create a Z program , you can then dynamically select the current month in the Variant and assign the Z program and the variant in ABAP step of the process chain.
    Hope this helps with your requirement.
    Regards,
    BINETWEAVER2004s

  • Create min(date) for Customer in BMM layer

    Hi guys,
    I need help in creating a first order date for a customer. I want to do this in BMM layer and use directly in reports.
    How should i create this?
    Any help Appreciated.

    I think its you sent me email with samilar Q.
    If you are doing in BMM you need to understand the schema
    assuming you got fact,day, custmer tables
    and these joined as star.
    you need to create a metric on fact as min(day.date) and set content tab to customer level
    for this you might have to map day dim to fact using fact source properties add day table.
    once you done as I said:
    just pull mindate metric in answers run it and check physical sql that should be like
    select min(date),cust_name from
    fact,day,customer
    where 2 joins goes
    group by cust_name
    Hope this helps, if helps mark

  • BIA Test: Suggestion for creating enormousTest Data for Infocubes

    Hi,
    I need to create some enormous amount of data for infocube in order to test BIA.
    I don't think my basis team will allow me to load data from Production to Sandbox and moreover production has less than 250 millions records.
    Any suggestion for 250 million records?

    Hello,
    Just an idea. If you can load a minimum of data for your cube then it is easy.
    You just have to generate for your cube for instance a datasource and then create some update rules to loop on your data.
    a. generate export datasource
    b. map it to your infosource
    c. define some update rules to ensuere your data will be different. For example in the start routine.
    Hope it helps.
    Patrice

Maybe you are looking for

  • BPM doesn't work

    Hi I have reinstalled the XI-Server and implemented a simple File-to-File scenario with and without BPM but neither one worked. The file wasn't deleted from the server. no messages appear in sxmb_moni Maybe a problem with the adapter engine? What sho

  • Does anyone have an answer?

    "I need to isolate my scanned pencils from their original background in order to ink and color them. How do I do this?

  • Problem in  setting Composite Instance Index in SOA 11G

    In SOA 11G the setIndex() xpath function is not working . But It was working in 10G. If I use this setIndex function in BPEL Java Embedding , in audit trails the function is executed. But If I see the result by querying the DEV_SOAINFRA.COMPOSITE_INS

  • HT203167 i have lost my library of tunes films and books

    I have had a terrible time with this application , for itunes , i bought a samsung phone and used the apps to itune which it accepted but when i went on line and followed the video to connect it will not connect so deleted all the applications from m

  • What is wrong with adding a BLOB column?

    What is wrong with adding a BLOB column? SQL>  alter table employee_dp add photo(blob(3000000); alter table employee_dp add photo(blob(3000000) ERROR at line 1: ORA-00902: invalid datatype SQL> alter table employee_dp add photo bolob(3000000); alter