Gets the number of months to a Date

Hello

I use the version of database Oracle 11.2.1. I would like to calculate the number of fiscal month of a date.

For example:

Date: 31/03/2013
Fiscal No. month: 12

The fiscal year runs from 01 - Apr-31 - March each year.

Hello

You can use

EXTRACT (MONTH FROM (ADD_MONTHS (mydate, -3)))

Example:

WITH mytable AS (    SELECT TRUNC(SYSDATE) - 400 + LEVEL mydate
                       FROM DUAL
                 CONNECT BY LEVEL <= 400)
SELECT mydate, EXTRACT (MONTH FROM (ADD_MONTHS (mydate, -3))) fiscal_month
  FROM mytable
 WHERE mydate = TRUNC (mydate, 'MM')
    OR mydate = LAST_DAY(mydate);

MYDATE    FISCAL_MONTH
--------- ------------
31-MAR-12           12
01-APR-12            1
30-APR-12            1
01-MAY-12            2
31-MAY-12            2
01-JUN-12            3
30-JUN-12            3
01-JUL-12            4
31-JUL-12            4
01-AUG-12            5
31-AUG-12            5
01-SEP-12            6
30-SEP-12            6
01-OCT-12            7
31-OCT-12            7
01-NOV-12            8
30-NOV-12            8
01-DEC-12            9
31-DEC-12            9
01-JAN-13           10
31-JAN-13           10
01-FEB-13           11
28-FEB-13           11
01-MAR-13           12
31-MAR-13           12
01-APR-13            1

Kind regards.
Al

Tags: Database

Similar Questions

  • is there an easy way to get the number of months in a year in a date range?

    Hi, experts, I am a newbie.

    are there any easy ways to get the number of months in a year in a date range?

    I would like to write a user-defined function.

    the input parameters are startdate, enddate, year

    the output is a number, not a month.

    for example, case 1

    StartDate = 01032009 (DDMMYYYY)
    end date = 28022010 (DDMMYYYY)
    If the year 2009, the output is 10
    If the year = 2010, the output is 2

    case 2:

    StartDate = 10032009 (DDMMYYYY)
    end date = 15032010 (DDMMYYYY)
    If the year 2009, the output is 10
    If the year = 2010, the output is 3

    Thank you very much!

    Hello

    You can (also) try this:

    SQL> with s as (
      2  ------------ Sample data -------------
      3  select to_date('01032009','ddmmyyyy') startdt, to_date('28022010','ddmmyyyy') enddt, 2009 yr from dual
      4  union all
      5  select to_date('01032009','ddmmyyyy') startdt, to_date('28022010','ddmmyyyy') enddt, 2010 yr from dual
      6  union all
      7  select to_date('10032009','ddmmyyyy') startdt, to_date('15032010','ddmmyyyy') enddt, 2009 yr from dual
      8  union all
      9  select to_date('10032009','ddmmyyyy') startdt, to_date('15032010','ddmmyyyy') enddt, 2010 yr from dual
     10  ------------ Sample data -------------
     11  )
     12  select startdt, enddt, yr,
     13  months_between(
     14          least(trunc(to_date(yr+1,'yyyy'),'year') , add_months(trunc(enddt,'month'),1))
     15          , greatest(trunc(to_date(yr,'yyyy'),'year') , trunc(startdt,'month'))
     16  ) nbmonths
     17  from s;
    
    STARTDT    ENDDT              YR   NBMONTHS
    ---------- ---------- ---------- ----------
    01/03/2009 28/02/2010       2009         10
    01/03/2009 28/02/2010       2010          2
    10/03/2009 15/03/2010       2009         10
    10/03/2009 15/03/2010       2010          3
    

    It's pretty simple. (no connection with, without functions SQL only integrated multicast, etc...)

  • Get the number of month, week and day between 2 dates

    Hi all

    Is it possible to display the number of months, weeks and days between 2 dates? by using only the SQL or PL/SQL...

    Entry:
    Date: October 1, 2010
    Date: October 19, 2010

    I want output like below (assuming starts the week from Monday to Sunday in oracle).

    October 1, 2010-(since it's in the middle of the week)
    October 2, 2010-(since it's in the middle of the week)
    October 3, 2010-(since it's in the middle of the week)
    40. (4 Oct-10 Oct falls into the 40th week of the year)
    41. (11 Oct-17 Oct falls into the 41st week of the year)
    October 18, 2010-(since it's in the middle of the week)
    October 19, 2010-(since it's in the middle of the week)


    Note: If there is a month between the date, the number of the month should be displayed.
    End of the month, the remaining date included with a full week, then the week of the year number should
    displayed. After posting the week, remaining dates should be displayed as it is...


    Appreciate your help...



    Thank you.
    Fox.

    You mean something like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  WITH t AS (select date '2010-09-27' as fdate, date '2010-11-21' as tdate from dual)
      2  --
      3  -- END OF TEST DATA
      4  --
      5  select dt2
      6  from (
      7        select dt,
      8               case when days_of_mn = days_in_month then 'Whole: '||to_char(dt,'Month')
      9                    when days_of_wk = 7 then 'Week: '||to_char(dt,'fmWW')
     10               else to_char(dt, 'DD-fmMonth-YYYY')
     11               end as dt2
     12              ,row_number() over (partition by
     13                 case when days_of_mn = days_in_month then to_char(dt,'Month')
     14                                  when days_of_wk = 7 then 'Week: '||to_char(dt,'fmWW')
     15                 else to_char(dt, 'DD-fmMonth-YYYY')
     16                 end order by dt) as rn
     17        from (
     18              select dt, wk, mn, days_in_month
     19                    ,count(*) over (partition by wk) as days_of_wk
     20                    ,count(*) over (partition by mn) as days_of_mn
     21              from (
     22                    select fdate+rownum-1 as dt
     23                          ,to_number(to_char(fdate+rownum-1,'fmWW')) as wk
     24                          ,to_number(to_char(fdate+rownum-1,'fmMM')) as mn
     25                          ,to_number(to_char(last_day(fdate+rownum-1),'fmDD')) as days_in_month
     26                    from t
     27                          connect by rownum <= tdate-fdate+1
     28                   )
     29             )
     30        ) x
     31  where rn = 1
     32* order by dt
    SQL> /
    
    DT2
    -----------------
    27-September-2010
    28-September-2010
    29-September-2010
    30-September-2010
    Whole: October
    Week: 44
    Week: 45
    Week: 46
    19-November-2010
    20-November-2010
    21-November-2010
    
    11 rows selected.
    
    SQL>
    
  • How to get the days and months when two dates are given

    Hi all

    I have a requirement where I need to return the number of months and days between two given dates.
    I have no need to take account of the year as the difference in dates is always less than a year

    I have 28 June 2012 and January 31, 2013, as dates.

    I'm working on 10g

    When I select the double months_between(:a,:b) and provide the dates he gives me 7.09677
    I want to give only 7 months and 9 days, or what ever the exact days are.

    Your contributions are appreciated

    Try this:

    WITH t AS
    (SELECT TO_DATE('28-JUN-2012', 'DD-MON-YYYY') date1, TO_DATE('31-JAN-2013', 'DD-MON-YYYY') date2 FROM dual)
    SELECT TRUNC(MONTHS_BETWEEN(date2, date1)) months,
           date2 - ADD_MONTHS(date1, TRUNC(MONTHS_BETWEEN(date2, date1))) days
    FROM   t
    
  • Get the number of months between the dates.

    Hi I need to get the exact number of months between the dates. So if I'm Sysdate - to_date(31-JAN-2011) I should get something like 8.4 months. Months_between function doesn't quite give me what I need. Is it possible that I can do this?

    876056 wrote:
    Hi I need to get the exact number of months between the dates. So if I'm Sysdate - to_date(31-JAN-2011) I should get something like 8.4 months. Months_between function doesn't quite give me what I need. Is it possible that I can do this?

    I don't see how you get 8.4 months. The counted months are February, March, April, may, June, July, August and, as of today, 9 and change the days of September. Unless I forgot the lessons of counting, I learned in kndergarten is 7 full months and a bit.

    Maybe you want something like:

    SQL> select months_between(Sysdate, to_date('01-JAN-2011', 'dd-mon-yyyy')) mb,
      2         (Sysdate - to_date('01-JAN-2011', 'dd-mon-yyyy'))/30 div30
      3  from dual;
    
            MB      DIV30
    ---------- ----------
    8.27800142 8.38726813
    

    If you get the form date a table, you can use trunc (date_column, 'mm') at the date of the first day of the month.

    John

  • How to get the number of months missing

    I created a view as follows:

    CREATE OR REPLACE FORCE VIEW 'Vinfection1' ('MONTH', 'COUNT') AS
    Select 'MONTHS', 'COUNT' in)
    Select to_char(s.pdate,'Mon-yyyy') in the month, count (*) County
    of s surproc, diagnosis_surproc d
    where s.surprocid = d.surprocid and d.diagnosisid in ('506 ', ' 507', '508 ","509", ' 510')
    Group of to_char(pdate,'Mon-yyyy'))
    order of to_date(month,'Mon-yyyy')
    /

    A few months are missing from the view. I want to put this month and 0 in the view. How to do?

    Thank you
    Jennifer

    can be like that...

    select      to_char(s.pdate,'Mon-yyyy') as month,
         sum(case when d.diagnosisid in ('506', '507', '508', '509', '510') then 1 ELSE 0 END) as count
    from surproc s, diagnosis_surproc d
    where s.surprocid = d.surprocid
    group by to_char(pdate,'Mon-yyyy')
    

    HTH...

    Thank you...

  • Get the number of the month

    DB version: 10 gr 2

    I was asked to give a slow query performance.

    I think that he is trying to get the number of months (as of June 6, July 7) after a few months to add logic. I replaced the column date with sysdate.

    The query looks like
    SELECT TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('01-'||TO_CHAR(sysdate,'MON-RRRR'),'DD-MON-RRRR'),3),'MM')) from dual
    Is there room for improvement?

    Hello

    What is

    select EXTRACT(MONTH FROM sysdate) from dual;
    

    Concerning
    Peter

  • Count of the number of months with unpaid for the last six months

    Hello

    I now table to store the daily presence of each employee

    ATTENDANCESHEET

    EMPID

    PAYROLLDATE

    UNPAID

    1

    10/01/2013

    6

    1

    10/02/2013

    2

    1

    11/01/2013

    0

    1

    11/02/2013

    0

    1

    12/01/2013

    0

    1

    12/02/2013

    0

    1

    01/01/2014

    0

    1

    01/02/2014

    0

    1

    02/01/2014

    0

    1

    02/02/2014

    0

    1

    03/01/2014

    45

    1

    03/02/2014

    0

    2

    03/01/2014

    0

    2

    03/02/2014

    0

    I want to get the number of months used unpaid in the past 6 months (excluding the current).

    If the month of payroll, I'm in treatment is 4, 2014, I spend 4 as payrollmonth and 2014 as payroll year

    The application must check the latest 6 month data and number of months for which there is any unpaid value

    In the case above for month 4, 2014, the power required is

    EmpID

    County

    1

    2

    2

    0

    I use oracle 10g

    EXAMPLES OF DATA

    create the table attendancesheet as

    (

    Select 1 as empid, to_date (January 10, 2013 ',' DD/MM/YYYY ') as payrolldate, 6 paid by union double all the

    Select 1 as empid, to_date (10 February 2013 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 1 as empid, to_date (January 11, 2013 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 1 as empid, to_date (February 11, 2013 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 1 as empid, to_date (12 January 2013 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 1 as empid, to_date (February 12, 2013 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 1 as empid, to_date (1 January 2014 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 1 as empid, to_date (February 1, 2014 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 1 as empid, to_date (January 2, 2014 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 1 as empid, to_date (February 2, 2014 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 1 as empid, to_date (3 January 2014 ',' DD/MM/YYYY ') as payrolldate, 45 paid by union double all the

    Select 1 as empid, to_date (3 February 2014 ',' DD/MM/YYYY ') as payrolldate, 0 paid by union double all the

    Select 2 as empid, to_date (3 January 2014 ',' DD/MM/YYYY ') as payrolldate, 0 as default all the double union

    Select 2 as empid, to_date (3 February 2014 ',' DD/MM/YYYY ') as payrolldate, 0 paid double

    );

    Help, please

    Hello

    So, you want to count the distinct months for 6 months before (not included) the given month; is this fair?

    Here's one way:

    VARIABLE month VARCHAR2 (2)

    Year VARIABLE VARCHAR2 (4)

    EXEC: months: = '4';

    EXEC: year: "2014"; =

    WITH got_end_date AS

    (

    SELECT TO_DATE (: month |) '/' || : year

    , ' MM/YYYY ".

    ) AS end_date

    OF the double

    )

    SELECT a.empid

    , COUNT (DISTINCT

    CASE

    WHEN a.unpaid > 0

    THEN TRUNC (a.payrolldate, 'MONTH')

    END

    ), Cnt

    Of attendancesheet one

    JOIN e-got_end_date WE a.payrolldate > = ADD_MONTHS (e.end_date-6)

    AND a.payrolldate< >

    GROUP BY a.empid

    ORDER BY a.empid

    ;

    If you use a WHERE clause to exclude the lines with some outstanding = 0 (or unpaid is NULL), then you would get no output for employees like empid = 2 in this example.  A WHERE clause ignores an entire line, so I used an expression BOX just a value.

  • Calculation of the number of months

    Hi guys,.

    How to calculate the number of months between two dates

    Opening date: 20/02/2014

    Closing date: 20/03/2015

    Terms of months: 13

    How I get the year and subtract and multiply by 12 and then add it to the difference of the month? Sorry that I am not well versed in the scripts.

    Thanks in advance.

    In this way, you have provided the example. You can change the constant string to the necessary code to get the value of a field. You can add additional to prevent code by using the code until the two fields have a non-null value.

  • REQ: script to calculate the number of months

    Looking for a script that will calculate the number of months between 2 dates (to 2 decimal points)

    or if there is a way to make a calculation of the number of months

    for example: if I go to google and say 75 days - months, it returns a value of 2.46

    That's what I'm looking for

    If anyone can help?

    with a calculation of date or number calculation?

    I tried # days / 365 x 12 but there is no decimal places.  right guard rounded up/down

    As mentioned in a month, the days are not constant throughout the year and change formula 28-31 days. How are you calculating the decimal value of the month?

    A year has 365 days, if she did then there would be no need for leap years and centuries jump.

    Calculation of a variable with the result of a calculation method is set to decimal.

    cDateFormat = "d-mmm-yyyy";
    var cStartDate = "January 1, 2000;
    var oStartDate = util.scand (cDateFormat, cStartDate);
    oStartDate.setHours (0, 0, 0, 000);
    var cEndDate = "January 15, 2000;
    var oEndDate = util.scand (cDateFormat, cEndDate);
    oEndDate.setHours (0, 0, 0, 000);
    nDiff var = oEndDate.getTime () - oStartDate.getTime ();
    Console.println ("end date:" + cEndDate);
    Console.println ("start date:"+ cStartDate ");
    Console.println ("difference in milliseconds:" + nDiff);
    Console.println ("difference in seconds:" + nDiff/1000);
    Console.println ("difference in minutes:" + nDiff / (1000 * 60));
    Console.println ("difference in hours:" + nDiff / (1000 * 60 * 60));
    Console.println ("difference in days:" + nDiff / (1000 * 60 * 60 * 24));
    Console.println ("difference in weeks:" + nDiff / (1000 * 60 * 60 * 24 * 7));
    Console.println ("difference over the years:" + nDiff / (1000 * 60 * 60 * 24 * 365.2524));
    Console.println ("difference in months:" + nDiff / ((1000 * 60 * 60 * 24 * 365.2524) / 12));  12 months in a year;

    End date: January 15, 2000
    Start date: January 1, 2000
    Difference in milliseconds: 1209600000
    Difference in seconds: 1209600
    Difference in minutes: 20160
    Difference in hours: 336
    Difference in days: 14
    Difference of weeks: 2
    Difference in years: 0.0383296591617194
    Difference in months: 0.45995590994063273

    Several turncate the decimal values scirpts because keeping them may not meet the need of specific calculation. You know that there are methods to roud until the next iniger, round.5 to the top and turnacate to the lower intiger.

    According to the date of departure, the values may be different:

    For a start date of February 1, 2000, 75 days would be 1,810 months but for a start date of 1 February 2001 75 days becomes 1,838 since the number of days of changes of February 29 to 28 and the number of days for the month of fractions varies from 26 to 27.

  • Get the number of days in a month based on the month and year of fields

    I have a column in my form which lists the days in a month. I want to configure a hidden field that calculates the total number of days in a month, based on the month and year of the field inputs. The number of days will determine what appears on the column. For example, if I put 4 months, and 2016 in the field of the year, I get 30 in the hidden field. Thus, on the column 'Day', I'll have numbers 1-30. Or if I put 2 months and 2016 in the field of the year, I get the 29 in the hidden field. If the numbers 1-29 appears in the column 'day '.

    Found this on some forum javascript code:

    //Month is 1 based
    function daysInMonth(month,year) {
      
    return new Date(year, month, 0).getDate();
    }

    //July
    daysInMonth
    (7,2009); //31
    //February
    daysInMonth
    (2,2009); //28
    daysInMonth
    (2,2008); //29

    I do not know how to convert this code in JavaScript to adobe and don't really know how to use it. All I know how to do is to configure the field values for the field month and year as variables. I am a novice programmer and would appreciate it really all the help I can get. Thank you in advance!

    The code seems to be JavaScript and runs as needed by using the JavaScript console.

    I would like to consider making more general code, so if you have a date string that includes at least the month and year we could just call the function and get the number of days for that month.

    The following script will calculate the number of days in a month, by using at least the month and year values can display the result on the JavaScript console and all of the value field for the field that has this code as the custom calculation Script.

    function daysInMonth (oDate) {}
    return new Date (oDate.getFullYear (), oDate.getMonth () + 1, 0) .getDate ();
    }

    nMonth var = this.getField("Month").valueAsString; get the value of month;
    nYear var = this.getField("Year").valueAsString; get the value of the year;

    Event.Value = "";

    If (nMonth! = "" & nYear!) = "") {}
    var MyDate = util.scand ("' / mm/yyyy ', nMonth +" / "+ nYear); convert to date object;
    var nDaysInMonth = daysInMonth (MyDate); get the number of days;

    Console.Open (); Open the JavaScript console;

    Console.clear(); clear the console;

    Console.println ("Days in" + nMonth + ":" + nDaysInMonth); show days in month;

    Event.Value = nDaysInMonth; Set the value of the field;

    }

  • Get the number of days, months and year

    Hi all

    I'm using OBIEE 11 g. I have a line of dash for year (2010, 2011, etc.) and months (Jan, Feb,..., Dec). How can I get the number of days in a given month and year in my report?

    For example, if I choose to Jan & 2011, I'd get 31 and 356. And if I choose Feb & 2011, I would get 28 and 356.

    Thank you!

    I have something more good option here... Try to use this

    DAYOFMONTH (TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-1, TIMESTAMPADD (SQL_TSI_MONTH, 1, CURRENT_DATE)))

    This will give you the days for the month in progress (Oct 2011) after calculating the last day of each month... Similary dynamically pass the value Date or month... You will need to modify this function but shud be simple. Hope this helps :)

  • HELP - how to get the number of virtual machines on a data store?

    Looking at the inventory of the data store in the VI client, there are a "number of Virtual Machines:" according to the General information for the Summary tab... I'm looking for a script that retrieves this information for me...

    I started the script but I'm stuck... I am very new on this...

    Get-Datastore. WHERE-object {$_ .name - like "wlp" ' "} #this gives me all the data which are not local warehouses

    Could someone give an overview on how to script to retrieve the number of virtual machines on data warehouses...

    Thank you, Lee

    Sorry, something went wrong with the copy - paste

    Get-Datastore | where {$_.Name -like "vmfs*"} | Sort-Object -Property Name | %{$_ | select @{N="DSname"; E={$_.Name}},
                                                                          @{N="VMcount";E={($_ | Get-VM | Measure-Object).count}}}
    
  • Get the number of elements in the header in GroupDataModel

    Hey everybody!

    I wonder how to get the number of items in each topic in a GroupDataModel. Here's a code, where headerCount would be the number of items in each section:

    ListView {
                dataModel: _app.dataModel
    
                layout: StackListLayout {                    headerMode: ListHeaderMode.Sticky            }
    
                listItemComponents: [
                    ListItemComponent {
                        type: "header"
    
                        Container {
                            Label {                            text: ListItemData + " " + headerCount                        }
                        }
                    },
                    ListItemComponent {
                        type: "item"
    
                        Container {
                            Label {                            text: ListItemData.cardName                        }
                        }
                    }
                ]
            }
    

    Also here is the code of applicationui.cpp, where it defines the datamodel. It's using GroupDataModel.

    void ApplicationUI::initDataModel()
    {
        // Note: The Group Data Model is joining this objects tree as a child (for memory management)
        m_dataModel = new GroupDataModel(this);
        m_dataModel->setSortingKeys(QStringList() << "cardType");
        m_dataModel->setGrouping(ItemGrouping::ByFullValue);
    }
    

    Hope that makes sense. If you have any questions, let me know!

    This will help you

    https://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__GroupDataModel.html#functio...

    Your header looks like this

    ListItemComponent {
        type: "header"
    
        Container {
            id: rootItem
            Label {
                text: ListItemData + " " + rootItem.ListItem.view.dataModel.childCount(rootItem.ListItem.indexPath)
            }
        }
    }
    ..............
    

    It may be useful

  • get the number in the declaration of DBMS

    Hello everyone,

    my friend, I create the following code, but I've always faced a problem to display the result of County all the

    the code is:

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

    I insert a count (*) to get the number of employees

    but he keep get only '1' to the last of the result in the following way:

    DETAILS OF THE EMPLOYEE:

    YJOSEPH5 | YOUSEFJOSEPH | 15 NOVEMBER 15

    HYOUSEF10 | HASSANYOUSEF | 15 NOVEMBER 15

    HYOUSEF17 | HASSANYOUSEF | 15 NOVEMBER 15

    HYOUSEF14 | HASSANYOUSEF | 15 NOVEMBER 15

    HYOUSEF16 | HASSANYOUSEF | 15 NOVEMBER 15

    COUNT: 1

    the code

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

    DECLARE
    V_USER_ID VARCHAR2 (50);
    NUMBER OF V_EMP_NO;
    V_FIRST_NAME VARCHAR2 (30);
    V_LAST_NAME VARCHAR2 (30);
    DATE OF V_REG_DATE;
    NUMBER OF V_COUNT;
    V_SQL_SATEMENTS VARCHAR2 (1000);
    NCOUNT THE NUMBER;
    CURSOR C IS SELECT USER_ID, EMP_NO, FIRST_NAME, LAST_NAME, REG_DATE, COUNT (*) FROM EMP
    USER_ID, FIRST_NAME, LAST_NAME, EMP_NO, REG_DATE GROUP;
    BEGIN
    OPEN C;
    SELECT COUNT (*) FROM NCOUNT FROM USER_TABLES WHERE TABLE_NAME = 'EMP ';
    IF (NCOUNT < = 0) THEN
    V_SQL_SATEMENTS: =' CREATE TABLE EMP)
    USER_ID VARCHAR2 (40) PRIMARY KEY,.
    NUMBER OF EMP_NO,
    FIRST NAME VARCHAR2 (30),
    VARCHAR2 (30) LAST_NAME,.
    DATE OF REG_DATE)';

    RUN IMMEDIATELY "DROP TABLE EMP;
    IMMEDIATELY RUN V_SQL_SATEMENTS;
    END IF;

    SELECT NVL (MAX (EMP_NO), 0) + 1
    IN V_EMP_NO
    YOUSEF. EMP;
    INSERT YOUSEF. EMP (USER_ID, EMP_NO, FIRST_NAME, LAST_NAME, REG_DATE)
    VALUES (SUBSTR (: LAST NAME, 1, 1) |: LAST_NAME |) V_EMP_NO, V_EMP_NO,:FIRST_NAME,:LAST_NAME,TO_DATE(SYSDATE,'DD-MON-YY'));
    DBMS_OUTPUT. PUT_LINE (' DETAILS OF THE EMPLOYEE: "");
    LOOP
    EXTRACT THE C IN V_USER_ID, V_EMP_NO, V_FIRST_NAME, V_LAST_NAME, V_REG_DATE, V_COUNT;
    WHEN THE EXIT %C NOTFOUND;

    DBMS_OUTPUT. PUT_LINE (V_USER_ID |'|) ' || V_FIRST_NAME | V_LAST_NAME |' | ' || V_REG_DATE);
    END LOOP;
    DBMS_OUTPUT. PUT_LINE ("COUNT:" | "|") V_COUNT);

    CLOSE C;
    END;
    /

    ALL FRIENDS,

    THANKS FOR EVERY BODY,

    I JUST FOUND THE RIGHT WAY TO DO

    FOR THOSE WHO WANT TO SEE:

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

    DECLARE
    V_USER_ID VARCHAR2 (50);
    NUMBER OF V_EMP_NO;
    V_FIRST_NAME VARCHAR2 (30);
    V_LAST_NAME VARCHAR2 (30);
    DATE OF V_REG_DATE;
    NUMBER OF V_COUNT;
    V_SQL_SATEMENTS VARCHAR2 (1000);
    NCOUNT THE NUMBER;
    CURSOR C IS SELECT USER_ID, FIRST_NAME, LAST_NAME, EMP_NO FROM EMP REG_DATE;
    BEGIN
    SELECT COUNT (*) IN THE EMP V_COUNT;
    OPEN C;
    SELECT COUNT (*) FROM NCOUNT FROM USER_TABLES WHERE TABLE_NAME = 'EMP ';
    IF (NCOUNT<=0)>
    V_SQL_SATEMENTS: =' CREATE TABLE EMP)
    USER_ID VARCHAR2 (40) PRIMARY KEY,.
    NUMBER OF EMP_NO,
    FIRST NAME VARCHAR2 (30),
    VARCHAR2 (30) LAST_NAME,.
    DATE OF REG_DATE)';
                                             
    RUN IMMEDIATELY "DROP TABLE EMP;
    IMMEDIATELY RUN V_SQL_SATEMENTS;
    END IF;

    SELECT NVL (MAX (EMP_NO), 0) + 1
    IN V_EMP_NO
    YOUSEF. EMP;
    INSERT YOUSEF. EMP (USER_ID, EMP_NO, FIRST_NAME, LAST_NAME, REG_DATE)
    VALUES (SUBSTR (: LAST NAME, 1, 1) |: LAST_NAME |) V_EMP_NO, V_EMP_NO,:FIRST_NAME,:LAST_NAME,TO_DATE(SYSDATE,'DD-MON-YY'));
    DBMS_OUTPUT. PUT_LINE (' DETAILS OF THE EMPLOYEE: "");
    LOOP
    EXTRACT THE C IN V_USER_ID, V_EMP_NO, V_FIRST_NAME, V_LAST_NAME, V_REG_DATE;
    WHEN THE EXIT %C NOTFOUND;

    DBMS_OUTPUT. PUT_LINE (V_USER_ID |'|) ' || V_FIRST_NAME | V_LAST_NAME |' | ' || V_REG_DATE);

    END LOOP;

    CLOSE C;
    DBMS_OUTPUT. PUT_LINE ("COUNT:" | "|") V_COUNT);

    END;
    /

Maybe you are looking for

  • How can I sort photos in iphoto?

    I used to be able to move photos into albums by dragging them around, but I can't do more. Is there a way to fix this?

  • Constant folding in 2009 vs 8.2

    Constant decline, or display these, changed from 8.2? I have constant retreat on structures, as well as sons. Note that I have a structure and a thread that do not match...

  • System down daily with the error message BCCode: 1000008e

    Original title: PC crashes my system hangs once a day and I get this error BCCode: 1000008e BCP1: C0000005 BCP2: BF1B3502 BCP3: A881F0F0.  What to say and how to fix it.  I am running the latest version of Windows XP.  Thank you.

  • E-mails were deleted after compacting outlook express

    Original title: cancel the outlook express compacting files after compression it removal of e-mails from 23/02/10 to present After compaction it deleted e-mails from 23/02/10 to present

  • Hard drive works 100%

    I have an Inspiron N5010 A04, OS Windows 10 Home.  The hard drive works 100% for minutes at a time as shown in the Task Manager Performance page, the player lists that ST9500325AS 500.11 GB, is there something I can do to reduce the amount of time th