How to get sales last day of the previous month

HELO guys

I have a question how do I get sales date last day of the previous month where my fact table is level. in fact I tried using Ago but it seems not working. for example, if I chose December 29, 2014 so if I used the function there are then the result will display data on November 29, 2014 (not the last day of November 2014).

Please guys if you have any solution and I really advise thanks to you.

Not exactly under what circumstances specific as you try to reach this goal, but suppose you have a few guest dashboard where you select a day and you have a report with a measure where you want to show the sales of the last day of the previous month based on the selected date in the dash prompt.

If you change the formula of this measure to something like:

FILTER (with the HELP of 'Sales' (DATE = TIMESTAMPADD (SQL_TSI_DAY-1, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH(@{PV_DATE_SELECTED}) * (-1) + 1, @{PV_DATE_SELECTED}))))

Tags: Business Intelligence

Similar Questions

  • How to get the last business day of the previous month?

    Hi all

    We need the user as below,

    If the user select 18 June 2015 ' quick dashboard as the input value, and then they want to see last month last day of work (business date: 29-may-2015) amount in report, if you have an idea please share with us.thanks

    Note:

    use under request we can able to get the last day of the previous month, we want to for the last business day of the last month, based on the date of entry of the user?

    TIMESTAMPADD (SQL_TSI_DAY,-(1), TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH ("DIM_TIME". ("" DataDate ") *-(1) + 1,"DIM_TIME ". (("" DataDate "))

    Thank you

    Deva

    Try this,

    case when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 1 then timestampadd (sql_tsi_day, (Dayofmonth(Date '2015-06-15') *-1)-2, Date '' 2015-06-15) when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 7 then timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1-1, Date '' 2015-06-15) another timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15') end

    As Ftsiot said in this post, it will work only to exclude the sat and Sun. Another one if you want to exclude regional holiday, you may need a calendar in DB table.

    Thank you

    AJ

  • Extract the first and the last Date of the previous month

    This seems to be a delicate but again it is perhaps easy for some of you people.

    Here is how I find the previous month

    Any ideas on how to get the first and last date of the previous month?

    Thanks in advance.

    Hello!

    SQL>
    SQL> select last_day(add_months(sysdate,-1)) from dual;
    
    LAST_DAY
    --------
    28.02.10
    
    SQL> select trunc(add_months(sysdate,-1),'MM') from dual
    
    TRUNC(AD
    --------
    01.02.10
    
    SQL> 
    

    T

  • Function to retrieve all the days of the previous month.

    Hello

    Yes, it's a monthly report, I received the task at hand.

    So, all I need is every day of the previous month (even if there is no data for that day)

    I was instructed to use the following code, but it does not return a value any:
    DECLARE
       CURSOR CUR_LAST_DAY IS
          SELECT TO_CHAR (LAST_DAY (ADD_MONTHS (SYSDATE, -1) ), 'DD')
            FROM DUAL;
     
       VVA_LAST_DAY   VARCHAR2 (2);
       --
       VNU_JOUR       NUMBER       := 0;
    BEGIN
       OPEN CUR_LAST_DAY;
     
       FETCH CUR_LAST_DAY
        INTO VVA_LAST_DAY;
     
       CLOSE CUR_LAST_DAY;
     
       WHILE VNU_JOUR <= TO_NUMBER (VVA_LAST_DAY) - 1
       LOOP
          VNU_JOUR := VNU_JOUR + 1;
       END LOOP;
    END;
    --CLOSE CUR_LAST_DAY
    --DEALLOCATE CUR_LAST_DAY
    -----
    On the other end, I developed this code:
    SELECT TO_CHAR(SYSDATE,'dd')
    FROM DUAL
    WHERE TO_CHAR(SYSDATE,'dd') >= to_char(to_date(to_char(ADD_MONTHS(SYSDATE, -1),'yyyy-mm')||'-01'),'yyyy-mm-dd')
    AND TO_CHAR(SYSDATE,'dd') < to_char(LAST_DAY(to_date(to_date(to_char(ADD_MONTHS(SYSDATE, -1),'yyyy-mm')||'-01'),'yyyy-mm-dd')));
    Which returns a null value. :(

    Concerning

    Hello
    You want to retrieve whole days of the month last query... So here's...

    SELECT
    TO_DATE(LEVEL||'-'||TO_CHAR(ADD_MONTHS(SYSDATE,-1),'MON-YY'),'DD-MON-YY') COMP_DATE,
    TO_CHAR(TO_DATE(LEVEL||'-'||TO_CHAR(ADD_MONTHS(SYSDATE,-1),'MON-YY'),'DD-MON-YY'),'DD') ONLY_DD,
    TO_CHAR(TO_DATE(LEVEL||'-'||TO_CHAR(ADD_MONTHS(SYSDATE,-1),'MON-YY'),'DD-MON-YY'),'MM') ONLY_MM,
    TO_CHAR(TO_DATE(LEVEL||'-'||TO_CHAR(ADD_MONTHS(SYSDATE,-1),'MON-YY'),'DD-MON-YY'),'YY') ONLY_YY
    FROM DUAL
    CONNECT BY LEVEL <= TO_NUMBER(TO_CHAR(LAST_DAY(ADD_MONTHS(SYSDATE,-1)),'DD'))
    

    I'm not at the machine database so not tested.

    But one thing do not forget that this forum only for reports, it is a separate SQL and pl/sql instance.
    Function to retrieve all the days of the previous month.

    -Clément

    Published by: Graham on April 22, 2010 22:53
    Spelling error

  • Difficulty accessing data by using the function of Ago - the end of the previous month

    Hey,.

    Recently, I met a problem that I can't fix on my own.


    I need to compare my portfolio to the current date / specified with the portfolio for intelligence and for the end of the previous month (the last day of the previous month).

    It looks like this :

    Capture.JPG

    My fact table consists of the list of contracts of loan that is updated daily. The data for the new day are added to the table, which actually resemble a large sandwich of various portfolios.


    To recover the data for the current/specified date and intelligence is not a problem. Current date - the date is read (can 10.08.2014), the day before - I use the Ago function (e.g., 09.08.2014).

    The real problem is getting the data for the last day of the month previous (e.g. 31.07.2014), since I can't put a specific to the function of Ago offset (10 days in our example), as the number of days from the end of the previous month is constantly - changing is a daily report.


    The best solution would be setting the offset function there is a dynamic value, which would change according to the user selects the date of the report. Can be based on the number of days in the month. BI strictly prohibits using anything that is not an integer in the offset value, so this isn't an option.


    I tried a work around using formulas in columns, like: FILTER ('facts of agreements'. "" Outstanding "USING ("Posting Date". "" Id of the day ' = TIMESTAMPADD (SQL_TSI_DAY, TIMESTAMPADD (1), (SQL_TSI_DAY, 'Date of Report'.) "Number of the day in the month" *-(1) + 1, DATE ' @{report_date}'))). "

    It did not work, since the data I receive are dated the last day of the previous month and date, which is applied to get the data for the current date filter / specified, it cuts.


    Tried to create another time the hierarchy, with the ends of period (week, month, quarter, year) and use it as a level at the Ago. He does work in part, offset the end of 1 month, but I can't bind the data, I get to the date of the report, as the Ago function returns random dates.


    I tried to search if people have had the same problems and it seems I'm the only one. I'm really desperate at this point, not even sure it's possible to get the result I need everything.

    So, please advise!


    Aurore

    Finally got sorted! Hoorey!

    Here's how it's done:

    I created a presentation variable 'report_date' for the user to choose the date of the desired report. That this formula has added to the column:

    FILTER ('facts of agreements'. "" Outstanding "USING ("facts of agreements". (("" Days late max "> 30))-there is (FILTER ('facts of agreements'. "" Outstanding "USING ("facts of agreements". ((("" Days late max "> 30)), TIMESTAMPDIFF (SQL_TSI_DAY, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (DATE ' @{report_date}') *-1, DATE ' @{report_date}" "), DATE ' @{report_date}'))

    Basically, this formula is used to calculate the difference between the current amount of the portfolio and the amount of portfolio for the last day of the last month (or at the end of last month), where only loans with number of days late over 30 are included.

    In the service there, I used a TIMESTAMPDIFF as a compensation formula to calculate the difference in days between the date of the report and the end of last month. Now no matter what date the user chooses it will give the correct difference in days.

    Really easy, but it took me a little time to get there.

    Hope this helps someone

  • How to get the last date of 3 days for the current month?

    Hello. Guy

    How to get the last date of 3 days for the current month?

    MY OUTPUT WOULD LOOK LIKE THIS

    JANUARY 29, 2016

    JANUARY 30, 2016

    JANUARY 31, 2016


    GUYS HELP ME / / /...

    SQL > select last_day (sysdate) - level + 1 double connect by level<= 3="" order="" by="">

    LAST_DAY)

    ---------

    29 JANUARY 16

    30 JANUARY 16

    31 JANUARY 16

  • How to get the last day of the week?

    HII

    I can get the week number of calendar for a given date using

    SELECT to_char (to_date('04/04/2011','MM/DD/YYYY'), 'WW') FROM dual

    can any body tell me, how to get the last day of the week?

    and the answer should be: 04/08/2011(8th april)
    Thank you
    San

    Published by: sandeep9 on April 4, 2011 03:50

    Perhaps this...

    SQL> select trunc(sysdate,'WW')+6 from dual;
    
    TRUNC(SYSDATE,'WW')+
    --------------------
    08-APR-2011 00:00:00
    
    SQL>
    
  • How to get the last day of the year

    Hi all

    Thanks in advance...

    How do I get the last day of the year that I'm passing date at run time.

    I can manage to get the first day of the year by
    SELECT TRUNC(SYSDATE,'YEAR') AS FDAY_YEAR
    of the double

    Thanks in advance

    Concerning
    Sachin
      1*  select ADD_MONTHS(trunc(sysdate,'yyyy'),12)-1 dd from dual
    SQL> /
    
    DD
    -----------
    31-DEC-2010
    
  • Get the last day of the month

    Hello

    How can I get the (day number of the) last day of a given month and year?

    So, if

    year 2015 = and month = 1, the output should be 31

    year = 2012 and month = 2 while production is expected to be 29

    year 2013 = and month = 2 while production is expected to be 28

    etc.

    Y at - it no OBIEE to achieve? If not, then a command SQL Oracle is very good too (I prefer OBIEE however)

    Thanks in advance,

    Erik

    You start from the first day of the month, you add 1 month [TIMESTAMPADD (SQL_TSI_MONTH, 1, 'your date')], you must subtract 1 day [TIMESTAMPADD (SQL_TSI_DAY,-1, 'your date')] and use the DAYOFMONTH function to get the number of the last day of the month [DAYOFMONTH ('your ' date')].

    All these calls nesting together and you're there.

  • Get the first and the last day of the month...

    Hi friends,

    I'm trying to get the first and last day of a month and wants to implement that in the following code:

    SELECT COALESCE (Date_A, Date_B, Date_C)
    OF the double

    Here Date A and B are in Format DD MM YYYY (March 14, 2008)
    and Date like MM YYYY (March 2008)

    How can I get the Date_C as of March 1, 2008, OR March 31, 2008 if Date A and B are NULL?

    Thank you!

    Published by: user11095386 on April 23, 2009 10:45

    Hello

    In my previous message, I thought that you were starting with strings like ' 03 12 2009"and you want to display in the form of" 12 March 2009'.» If what you have is just the opposite, then simply reverse strings format in my first message. Add a comma, if you want, in the format string.
    I think that's what you want:

    COALESCE ( TO_CHAR ( TO_DATE ( Date_A, 'fmMonth DD YYYY'), 'MM DD YYYY')
             , TO_CHAR ( TO_DATE ( Date_B, 'fmMonth DD YYYY'), 'MM DD YYYY')
             , TO_CHAR ( TO_DATE ( Date_C, 'fmMonth YYYY'),    'MM DD YYYY')
             )
    

    Notice how, on the 3rd line, TO_DATE is called without DD in the format string:

    TO_DATE ( Date_C, 'fmMonth YYYY')
    

    When you do so, by default the day the 1st of the month, so that's all you need to do to convert the VARCHAR2 'March 2009' at the DATE of March 1, 2009.

    If you would like the last day of the month, not the first, when Date_C is selected, then use LAST_DAY:

    COALESCE ( TO_CHAR ( TO_DATE ( Date_A, 'fmMonth DD YYYY'), 'MM DD YYYY')
             , TO_CHAR ( TO_DATE ( Date_B, 'fmMonth DD YYYY'), 'MM DD YYYY')
             , TO_CHAR ( LAST_DAY ( TO_DATE ( Date_C
                                              , 'fmMonth YYYY'
                                )
                         )
                 , 'MM DD YYYY'
                 )
             )
    
  • Last day of the year in fast formula

    Hi all

    I have to deal with something special, based on the last day of the current year.

    How can I get the last day of the year? Is there a function available in the fast formulas?

    Appreciate all entries...

    Thank you
    SRS

    What is

    :
    L_last_day = TO_DATE (' 31 - DEC-'+ TO_CHAR (PAY_PROC_PERIOD_END_DATE, 'YYYY'), 'DD-MON-YYYY')
    :

    Clive

  • Last day of the month with the last minute of the day

    Hello
    I wonder about how to get the last day of the month with the last minute of this day(23:59). We can use the last_day function (DATE) to get the last date, but reminds me of the time of day when the function has been executed. But I want to have the last minute with my last date of the current month.

    Please inform.

    Thank you

    HP

    Hello

    Ora_bie wrote:
    Hello
    I wonder about how to get the last day of the month with the last minute of this day(23:59). We can use the last_day function (DATE) to get the last date, but reminds me of the time of day when the function has been executed. But I want to have the last minute with my last date of the current month.

    In fact, it returns at the same time as the argument you pass; But whatever it is, is not what you want.

    This will return the last day of the month that contains the DATE 23:59 (or 23:59) dt:

    SELECT  ADD_MONTHS ( TRUNC (dt, 'MONTH')
                 , 1
                 ) - (1 / (24 * 60))
    FROM    dual
    ;
    

    TRUNC (dt, 'MONTH') is 00:00 on the first day of the month that contains dt.
    ADD_MONTHS (TRUNC (dt, 'MONTH'), 1) is from 00:00 the first day of the month following the one containing dt.
    ADD_MONTHS (TRUNC (dt, 'MONTH'), 1)-(1 / (24 * 60)) is a minute earlier.
    (Since there are 24 hours, each with 60 minutes, every day, 1 / (24 * 60) days is identical to a minute.)

    Another (less clear, in my opinion) way to get the same results is:

    TRUNC (LAST_DAY (dt)) + (1439/1440)  -- 1440 minutes = 1 day
    
  • Select SQL - last day of the month, a year from now

    Hello
    How do we get the last day of the month, a year from now.

    For example-sysdate-12/2/2009
    Result - 31/12/2009

    Thank you

    Hello

    SELECT  LAST_DAY ( ADD_MONTHS ( SYSDATE
                                  , 12
                )           )
    FROM    dual;
    

    Remember, all DATEs, including the results of this query, include the hours minutes and seconds.
    The hours, the minutes and the seconds returned by the above expression are the same as SYSDATE: If you run it at 15:43:30 today, it returns 15:43:30 on December 31, 2010. This can be important if you want to use an expression like this as the cut-off point in a WHERE clause.

  • Breaking a year in coming weeks of beginning and end Dates (parameters) and first and last day of the month

    Hello people:

    I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.

    Any help or pointers would be great!

    Thank you!

    Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).

    The request in hand:

    SELECT first_thursday + (7 * (LEVEL - 1))   AS week_start_date,
                     first_thursday + (7 * LEVEL) - 1    AS  week_end_date
    FROM
    (
      SELECT TRUNC(p_from_date + 4, 'IW') - 4   AS first_thursday, -- Week should start the pre ceeding THURSDAY based on the Start Date
                      TRUNC( p_to_date + 4,  'IW') - 5     AS last_wednesday
      FROM
      (
        SELECT to_date('01-JAN-2013') AS p_from_date,
                        NVL(to_date('31-DEC-2013'), SYSDATE) AS p_to_date
        FROM     dual
      ) parms
    ) end_points
    CONNECT BY LEVEL <= ( last_wednesday + 1 - first_thursday)/7;
    

    Currently, this is the result I get (I'm only including the months of January and December here).

    Week_Start_Date     Week_End_Date
    27-DEC-12                02-JAN-13
    03-JAN-13                 09-JAN-13
    10-JAN-13                 16-JAN-13
    17-JAN-13                 23-JAN-13
    24-JAN-13                 30-JAN-13
    31-JAN-13                 06-FEB-13
    

    December:

    28-NOV-13               04-DEC-13
    05-DEC-13              11-DEC-13
    12-DEC-13              18-DEC-13
    19-DEC-13              25-DEC-13
    

    What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:

    January:

    01-JAN-13              02-JAN-13
    03-JAN-13              09-JAN-13
    10-JAN-13             16-JAN-13
    17-JAN-13             23-JAN-13
    24-JAN-13             30-JAN-13
    31-JAN-13             31-JAN-13
    

    February:

    01-FEB-13    06-FEB-13
    07-FEB-13    13-FEB-13
    14-FEB-13    20-FEB-13
    21-FEB-13    27-FEB-13
    28-FEB-13    28-FEB-13
    

    November:

    31-OCT-13    06-NOV-13
    07-NOV-13    13-NOV-13
    14-NOV-13    20-NOV-13
    21-NOV-13    27-NOV-13
    28-NOV-13    04-DEC-13
    

    December:

    01-DEC-13           04-DEC-13
    05-DEC-13           11-DEC-13
    12-DEC-13          18-DEC-13
    19-DEC-13          25-DEC-13
    26-DEC-13          31-DEC-13
    

    Hello

    Roxyrollers wrote:

    Hello people:

    I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.

    Any help or pointers would be great!

    Thank you!

    Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).

    The request in hand:

    1. First_thursday SELECT + (7 * (LEVEL - 1)) AS week_start_date,
    2. first_thursday + (7 * LEVEL)-1 AS week_end_date
    3. Of
    4. (
    5. SELECT TRUNC (p_from_date + 4, 'IW') - 4 AS first_thursday,-week should start to perform the pre-mounted THURSDAY based on the Start Date
    6. TRUNC (p_to_date + 4, 'IW') - 5 AS last_wednesday
    7. Of
    8. (
    9. SELECT to_date('01-JAN-2013') AS p_from_date,
    10. NVL (to_date('31-Dec-2013'), SYSDATE) AS p_to_date
    11. OF the double
    12. ) parms
    13. ) end_points
    14. CONNECT BY LEVEL<= (="" last_wednesday="" +="" 1="" -="">

    Currently, this is the result I get (I'm only including the months of January and December here).

    1. Week_Start_Date Week_End_Date
    2. DECEMBER 27, 12 2 JANUARY 13
    3. JANUARY 3, 13 JANUARY 9, 13
    4. 10 JANUARY 13 JANUARY 16, 13
    5. 17 JANUARY 13 23 JANUARY 13
    6. 24 JANUARY 13 30 JANUARY 13
    7. 31 JANUARY 13 FEBRUARY 6, 13

    December:

    1. NOVEMBER 28, 13 4 DECEMBER 13
    2. 5 DECEMBER 13 DECEMBER 11, 13
    3. 12 DECEMBER 13 18 DECEMBER 13
    4. 19 DECEMBER 13 DECEMBER 25, 13

    What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:

    January:

    1. JANUARY 1, 13 2 JANUARY 13
    2. JANUARY 3, 13 JANUARY 9, 13
    3. 10 JANUARY 13 JANUARY 16, 13
    4. 17 JANUARY 13 23 JANUARY 13
    5. 24 JANUARY 13 30 JANUARY 13
    6. 31 JANUARY 13 JANUARY 31, 13

    February:

    1. 1ST FEBRUARY 13 FEBRUARY 6, 13
    2. 7 FEBRUARY 13 FEBRUARY 13, 13
    3. 14 FEBRUARY 13 FEBRUARY 20, 13
    4. 21 FEBRUARY 13 FEBRUARY 27, 13
    5. 28 FEBRUARY 13 FEBRUARY 28, 13

    November:

    1. 31 OCTOBER 13 NOVEMBER 6, 13
    2. 7 NOVEMBER 13 NOVEMBER 13, 13
    3. 14 NOVEMBER 13 NOVEMBER 20, 13
    4. 21 NOVEMBER 13 NOVEMBER 27, 13
    5. NOVEMBER 28, 13 4 DECEMBER 13

    December:

    1. 1ST DECEMBER 13 DECEMBER 4, 13
    2. 5 DECEMBER 13 DECEMBER 11, 13
    3. 12 DECEMBER 13 18 DECEMBER 13
    4. 19 DECEMBER 13 DECEMBER 25, 13
    5. 26 DECEMBER 13 DECEMBER 31, 13

    Why the "weeks" in November, have all 7 days, while the "weeks" in the first or the last week in the other month usually have less?  (For example, February 28 is a 'week' alone.)

    The following works for the other months:

    WITH all_days AS

    (

    SELECT DATE "2013-01-01' + LEVEL - AS a_date 1

    OF the double

    CONNECT BY LEVEL<=>

    )

    SELECT DISTINCT

    More GRAND (TRUNC (a_date + 4, 'IW') - 4)

    , TRUNC (a_date, 'MONTH')

    ) AS week_begin

    , The LEAST (TRUNC (a_date + 4, 'IW') + 2

    TRUNC (LAST_DAY (a_date))

    ), Week_end

    Of all_days

    ORDER BY week_begin

    ;

    Output:

    WEEK_BEGIN WEEK_END

    ----------- -----------

    January 1, 2013 January 2, 2013

    January 3, 2013 January 9, 2013

    January 10, 2013 January 16, 2013

    January 17, 2013 January 23, 2013

    January 24, 2013 January 30, 2013

    January 31, 2013 January 31, 2013

    February 1, 2013 February 6, 2013

    February 7, 2013 February 13, 2013

    February 14, 2013 February 20, 2013

    February 21, 2013 February 27, 2013

    February 28, 2013 February 28, 2013

    ...

    November 1, 2013 November 6, 2013

    November 7, 2013 November 13, 2013

    November 14, 2013 November 20, 2013

    November 21, 2013 November 27, 2013

    November 28, 2013 November 30, 2013

    December 1, 2013 December 4, 2013

    December 5, 2013 December 11, 2013

    December 12, 2013 December 18, 2013

    December 19, 2013 December 25, 2013

    26 December 2013 31 December 2013

  • ORA-01847: day of the month must be between 1 and the last day of the month

    Hi all






    Select
    To_date(mDate||) e '|| mtime, "YYYY-MM-DD HH24MISS") meddate
    of PR_MOCTEST_TEMP

    mDate IS OF TYPE of DATA VARCHAR2 AND mtime OF VARCHAR2

    mDate: 07-09-2009
    mtime: 131241

    mDate IS IN FORMAT DD-MONTH-YYYY
    mtime: HHMMS

    mtimeOF IS OF TYPE of DATA VARCHAR2 AND VARCHAR2 mDate

    mDate: 07-09-2009
    mTIME: 131241

    mDATE IS IN FORMAT DD-MONTH-YYYY
    mTIME: HHMMS

    I NEED TO COMBINE THE 2 COLUMNS TO GET THE OUTPUT AS DD-MM-YYYY HH24MISS
    AND I AM GETTING THE ERROR;


    ORA-01847: day of the month must be between 1 and the last day of the month

    where mistaken?

    Please notify


    Kai

    You will find the bad dates using a table of logging of errors:

    --we'll try to insert into here, invalid dates will be thrown out
    create table dst(d date);
    
    -- create an error log table dst_err
    exec dbms_errlog.create_error_log('dst', 'dst_err');
    
    -- try the insert. Will fail with your ORA-01847
    insert into dst select TO_DATE(mdate||' '||mtime,'DD-MM-YYYY HH24MISS') from PR_MOCTEST_TEMP log errors into dst_err('comment'); 
    
    -- view the errors
    select * from dst_err;
    

Maybe you are looking for