change the SQL of a view or an SP

I have a query that displays the user id expiration date. I want to run this as a view or a PC so I don't have access to dba_users in each

Anyone who wants to run this query.

[code]

set pagesize 500
set linesize 200
Set trimspool on
format of column "DATE of EXPIRY" a20
column "STATUS" format a15
--
-View the connections which will be completed in 120 days
--
Select the username as 'USER NAME', expiry_date as 'DATE EXPIRES. "
account_status than the 'STATUS' of dba_users
where expiry_date < sysdate + 120
and account_status IN ('OPEN', "EXPIRED (GRACE)")
order account_status, expiry_date, username

[/ code]

I'm looking to do something like this select * from expired_sp of dual and prodiuce the following results as my query don't. Can someone point me in the direction of riht on how do to convert this SQL statement...

USERNAME EXPIRES DA STATUS

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

U574616 3 OCTOBER 13 OPEN

E667910 3 OCTOBER 13 OPEN

F529847 31 DECEMBER 13 OPEN

Thanks in advance to all those who respond

Hello

The owner of the view (dba_maint in this case) must have privileges on dba_users WITH GRANT OPTION, given like this:

Grant select on sys.dba_users to dba_maint

WITH GRANT - very important OPTION

;

This means that dba_maint is allowed to see dba_users and also to give this privilege to others.

The view (such as xxx) users may not have WITH GRANT OPTION.  Chances are, you do not want to allow xxx give privileges on the view to other users, so when the granting of privileges to xxx, dba_maint would say

Grant select on DBA_MAINT. USER_ACCOUNTS_VW xxx

-with grant option-* DO NOT USE * only dba_maint can give privileges on this view

;

Tags: Database

Similar Questions

  • Windows Photo Viewer - how to change the default Windows Photo Viewer options so it will open the images directly in 'Real size' rather than the auto zoom

    Windows Photo Viewer - full size

    Hello

    Is there a way to change the default Windows Photo Viewer, so it will open the images directly in 'Real size' rather than the auto zoom?

    Thanks in advance, Yoni.

    Hi Yonikl,
     
    1 let me know the format of the file that is causing the problem?
    2. you have any third party photo editing and look at a software installed on your computer?
    3. do you have any recent software or the hardware changes on your computer?
     
    If there is any third party even software uninstall and check if that helps.
     
    You can follow these steps below to set the image at its actual size while watching.
     
    To display the image at its actual size, click actual size . To make the entire image enters the Windows Photo Viewer window, click on adjust to the window.
     
    For more information you can visit this article for assistance below.
     
     
    You can also try to download and install the Windows Live Photo Gallery and check if the problem persists.
     
    If the problem persists then you can try these steps below to create a new user account and check if the problem persists.
     
    Create a new user profile.
    Now you must create a new user account and check the question of do you need to follow the steps
    below.
    a. open user accounts by clicking the Start button.
    b. click Control Panel.
    c. click on user accounts.
    d. family Safety.
    e. click on user accounts.
    f. click on manage another account.
    g. If you are prompted for an administrator password or confirmation.
    h. type the password or provide confirmation.
    i. click on create a new account.
    j.Type the name you want to assign to the user account.
    k.Click an account type.
    l.Click create an account.
    Now search for the question.
     
    If you still face the question, then you can follow the link provided below to fix the damaged user profile.
     

    Thank you, and in what concerns:
    I. Suuresh Kumar - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Change the SQL report to Intractive report

    Dear friend


    I created the SQL report.

    Could you tell me please, there is a way to change the SQL report to Intractive report.

    How can I do that.

    Thank you

    Under the Definition of the region of the report; look over to the right margin and you will see interactive report-migrate under tasks .

    The f

  • Changing the SQL source region according to requirement

    I have a region of reports that shows the results of some SQL codes. According to the value of a variable to the page I need to run a little different from SQL to get my results. Right now I use 5 different regions and display one suitable and hide others, according to the value of the variable on the page.

    It's a bit messy and I'm looking for a better way to do it. Is it possible to use a single region and change the SQL used as the source of the region after checking my page variable? for example something like this for the source of the region:
    IF :report_type = 1 THEN
    
    SELECT col1, col2, col3 from table1;
    
    ELSEIF :report_type = 2 THEN
    
    SELECT col1, col2, col3 from table2;
    
    ELSEIF :report_type = 2 THEN
    
    SELECT col1, col2, col3 from table3;
    
    END IF;
    .. or something similar?

    Or is there an even easier way to do it?

    Hello

    for "normal" (non-interactive reports), you can provide a block plsql returning a sql query
    as the source of report...

    declare
    v_sql varchar2 (4000);
    Start
    IF: report_type = 1 THEN
    v_sql: = "SELECT col1, col2, col3 from table1";
    ELSE IF: report_type = 2 THEN
    v_sql: = "SELECT col1, col2, col3 from table2";
    ELSE IF: report_type = 2 THEN
    v_sql: = "SELECT col1, col2, col3 from table3";
    END IF;
    Return v_sql;
    end;

    as said - this does not work with interactive reports...

    Best regards

    Carsten-

  • change the SQL license without reinstalling the product?

    We are running out of SQL Server 2005 Workgroup Edition with merge replication, and we just hit a limit of product that we ignore to 25 subscriptions.
    Question: Can we change the Standard Ed license or remove this restriction somehow without having to re - install the product?

    Hello.

     
    Your question of Windows 7 is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT audience Pro on MSDN. Please post your question in the MSDN forum.
     
  • Change the wallpaper but missing view tab.

    I'm changing the wallpaper, but I do not have a view tab. Until I click on display in settings, this happens error loading theme "c:\documents and document\my theme.theme preferred owner is not a valid topic.

    First of all, make sure that the computer is free of viruses/malware, because this can be a symptom of infection.

    http://www.elephantboycomputers.com/page2.html#Removing_Malware

    If the computer is clean, here's an Kelly Theriot:

    http://www.kellys-Korner-XP.com/xp_w.htm

    Is he missing the tabs display, Kelly run registry edit side line 285, entitled "restore all display tabs.

    Check if these registry entries exist:

    User\Software\Policies\Microsoft\Windows\System HKCU\Software\Microsoft\Windows\CurrentVersion\GroupPolicyobject\ {21A7BE9D-5027-49C1-B6F7-757B707E1C94}
    If 'GroupPolicyRefreshTime' or "GroupPolicyRefreshTimeOffset" is there, then delete them.

    HKCU\Software\Policies\Microsoft\Windows\System. If 'GroupPolicyRefreshTime' or "GroupPolicyRefreshTimeOffset" is there, then delete them, and then run the page of Kelly reg fix.
    MS - MVP - Elephant Boy computers - don't panic!

  • Monitoring stops working after changing the SQL Service account

    I have the Foglight for SQL Server cartridge. I recently changed the service account that is running the SQL Server engine and SQL Server Agent from a local account to a domain account. Everything works fine on the SQL Server side.

    No configuration changes have been made on the Foglight end, and none should be necessary Foglight is configured to use a separate service for SQL account both OS level followed. This account has always been in the local "Administrators" Group on the database server, as well as a "sysadmin" on the side of SQL Server server role. If I 'validate connectivity' within Foglight to that server, it shows that the connection is correct. I tried to remove the monitoring officer and recreation, but yet to see errors in the attached screenshot. Has anyone meet a similar problem?

    Although I couldn't find any indication that the agents were locked, I tried to release them anyway. That seemed to do the trick!

    This can be found here:

    Databases-> Dashboard Support-> Support of databases-> release agents

  • change the picture editor no viewer

    Hello!

    For images, I like to keep my Active Viewer. What I want to change is the Photoshop editing program.

    How can I keep the Active Viewer but change the picture editor?

    Start Photoshop, open the image

    No settings to change

  • Tuning sql of a product to the seller without changing the sql statement

    Hello

    We have a product of the provider that generates the SQL statement. For a query, we get the answer in 15 seconds. But users are asking if we can bring it back to 5 seconds. Limitation is the query can not be changed. He used about 10 to 12 tables and bit complex query.

    What kind of options could be evaluated if we are to improve the performance of a query (not sure if she could never be reduced to 5 seconds)
    without making any change to the query.

    Database Version: Oracle 10.2.0.4

    Thank you
    Delphine

    Hello

    http://www.Oracle-base.com/articles/10G/AutomaticSQLTuning10g.php

    your software is enterprise or standard?

    Tuning Pack & pack diagnosis are extra cost option with the standard edition.

    & the useful note * automatic SQL Tuning - SQL [271196.1 ID] profiles *.

    http://www.Oracle.com/us/corporate/pricing/technology-price-list-070617.PDF

    Thank you

    Published by: CKPT November 5, 2010 11:12

  • Change the SQL syntax by sys_context

    Hi all

    When the user-defined function runs "select * of tb1, tb2 where tb1.a = tb2.a ' application.but web database convert in" select / * + use_nl (tb1, tb2) * / * of tb1, tb2 where tb1.a = tb2.a and then runs the query, I think by sys_context and DBMS_SQL, DBMS_SESSION we can implent it, please provide steps to implement...»


    Thank you
    VIJAY

    What version of Oracle?

    Depending on the version, you can look at dbms_advanced_rewrite, but you are not using bind variables?

    If you do not bind variables and the application issues the sql directly and this list can vary in length or you do not use cursor sharing, then you many options.

    You could make the application select view and have your Board in the view definition.

    Published by: dombrooks on October 23, 2009 10:30

  • How can I change the start menu to view all default programs?

    I'm trying to figure out how to get all default loading programs in the start menu (rather than recent programs showing, we disabled).  Y at - it a registry key that can be changed or created to do this?

    I'm trying to figure out how to get all default loading programs in the start menu (rather than recent programs showing, we disabled).  Y at - it a registry key that can be changed or created to do this?

    Hello

    There is no way to display the menu all programs when you click on the Start button. Start is similar to a toolbar. When you select it, it will show all the different components that you can access.

    You can stop the recent programs to display. Right-click the Start button and select Properties. In the privacy section, Remove the check mark from the option store and display recently opened programs in the start menu .

    I hope this helps.

    Thank you for using Windows 7

    Ronnie Vernon MVP
  • How can I change the email settings to view emails more than 2 weeks?

    I want to change my e-mail setting for the duration of what aol shows my new emails.  It shows that up to 2 weeks.

    Original title: How can I change email to display new emails over 2 weeks?

    Hello Denise,.

    If you look at the mail in the Mail application, you can use the following to adjust your sync settings.

    To change your sync settings

    1. On start, tap or click Mail.
    2. Enter in the right edge of the screen, and then tap Settings.
      (If you use a mouse, point to the upper right of the screen, move the pointer of the mouse down, then clickSettings).
    3. Press or click accounts.
    4. Press or click the account you want.

    Adjust these settings:

    • How many times your email Mail Downloads (for action as they arrive at all hours, or manually).
    • Back to how to pass messages (as short as three days at any time).
    • What content you want to downloaded (e-mail, calendar, contacts).

    Mark

  • Change the sql filter code trade name

    All,

    one of my filters is a "Term" Advanced sql code "' Code word ' = VALUEOF (NQ_SESSION. CSA_Analysis_Term)
    When I add the filter to the report (add a filter) the user does not understand the code above,
    and I can't seem to find a way to add a name to make it more useful to users.

    anyone tried it with that

    Thank you

    I see your problem...

    When you have used this session variable in filters part you are able to see the session instead of the value variable last rite?

    You have guest of dashboard set to "Term". "' Term Code ' to the dashboard page?
    If so, why by default the session here filters variable part of the report? by default it prompt default dashboard section...

    just say guest is on the code term column in your report

    Published by: Kishore Guggilla, November 29, 2010 23:38

  • Can I change the SQL of DW data?

    Very simple question, I hope!

    It is not a huge problem to open PHPmyAdmin to manually change an entry in a table of data, but it is possible through DW?

    FYI - I am to the current there are "UP-TO-DATE RECORDS WIZARD" for this sort of thing, however, I came across a delicate situation when one of my entries of ID is '0' where '0' does not exist in the table as a way to be identified... result is the page that has a mistake and does display no data. Even when you use the wizard.

    Thank you!

    Jason Semko wrote:

    It is not a huge problem to open PHPmyAdmin to manually change an entry in a table of data, but it is possible through DW?

    N °

    I am to the current there are "UP-TO-DATE RECORDS WIZARD" for this sort of thing, however, I came across a delicate situation when one of my entries of ID is '0' where '0' does not exist in the table as a way to be identified... result is the page that has a mistake and does display no data.

    N ° Dreamweaver has a record update form wizard. It is a wizard that is designed to simplify the creation of a form that is used to update the records.

    0 is not valid as a primary key in MySQL.

  • How to change the sql to include totals

    Here is the information required for assistance in this area
    CREATE TABLE APPLSYS.FND_USER
    (
      USER_ID                        NUMBER(15),
      USER_NAME                      VARCHAR2(100 BYTE),
      LAST_UPDATE_DATE               DATE,
      LAST_UPDATED_BY                NUMBER(15),
      CREATION_DATE                  DATE,
      CREATED_BY                     NUMBER(15),
      LAST_UPDATE_LOGIN              NUMBER(15),
      ENCRYPTED_FOUNDATION_PASSWORD  VARCHAR2(100 BYTE),
      ENCRYPTED_USER_PASSWORD        VARCHAR2(100 BYTE),
      SESSION_NUMBER                 NUMBER,
      START_DATE                     DATE,
      END_DATE                       DATE,
      DESCRIPTION                    VARCHAR2(240 BYTE),
      LAST_LOGON_DATE                DATE,
      PASSWORD_DATE                  DATE,
      PASSWORD_ACCESSES_LEFT         NUMBER(15),
      PASSWORD_LIFESPAN_ACCESSES     NUMBER(15),
      PASSWORD_LIFESPAN_DAYS         NUMBER(15),
      EMPLOYEE_ID                    NUMBER(15),
      EMAIL_ADDRESS                  VARCHAR2(240 BYTE),
      FAX                            VARCHAR2(80 BYTE),
      CUSTOMER_ID                    NUMBER(15),
      SUPPLIER_ID                    NUMBER(15),
      WEB_PASSWORD                   VARCHAR2(240 BYTE),
      USER_GUID                      RAW(16),
      GCN_CODE_COMBINATION_ID        NUMBER(15),
      PERSON_PARTY_ID                NUMBER
    )
    INSERT orders
    Insert into APPLSYS.FND_USER
       (USER_ID, USER_NAME, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, ENCRYPTED_FOUNDATION_PASSWORD, ENCRYPTED_USER_PASSWORD, SESSION_NUMBER, START_DATE, DESCRIPTION, PASSWORD_LIFESPAN_DAYS, EMPLOYEE_ID, EMAIL_ADDRESS, PERSON_PARTY_ID)
     Values
       (2248, '[email protected]', TO_DATE('11/02/2009 17:16:40', 'MM/DD/YYYY HH24:MI:SS'), 1234, TO_DATE('11/02/2009 17:16:40', 'MM/DD/YYYY HH24:MI:SS'), 1234, 3349708, 'ZHDF800E989435A83F862A9078E485E76CC82E51B508395BA3B492F48235BA712864AD0586670C82FA25C6597CC6560EF3D8', 'ZHC7A20CCEEC34081812AB931A0EBD4B5205F68AF5C1BA4FDD4A682F487D61B2CF755672F2C46BAF6717D5C578B3858DFC79', 0, TO_DATE('11/02/2009 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Monty Bilchitz', 30, 10262, '[email protected]', 39299);
    Insert into APPLSYS.FND_USER
       (USER_ID, USER_NAME, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, ENCRYPTED_FOUNDATION_PASSWORD, ENCRYPTED_USER_PASSWORD, SESSION_NUMBER, START_DATE, DESCRIPTION, LAST_LOGON_DATE, PASSWORD_DATE, PASSWORD_LIFESPAN_DAYS, EMPLOYEE_ID, EMAIL_ADDRESS, CUSTOMER_ID, PERSON_PARTY_ID)
     Values
       (2227, '[email protected]', TO_DATE('04/13/2010 12:39:04', 'MM/DD/YYYY HH24:MI:SS'), 2227, TO_DATE('11/02/2009 09:53:38', 'MM/DD/YYYY HH24:MI:SS'), 1295, 2227, 'ZH314A0F96175B5CDB8974DC680D364364C2C05AB28C8CCDF33AE6087FE0EFC2AA8CF2FC802A139AB0F9A6CCD371F500A38E', 'ZHBB417F192253772E4971BF55465F80F1A2794F2D468B4D94D7A16EABD2FE754F9DA64268FD614BC58FDBF7457BC137C901', 252, TO_DATE('11/02/2009 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Juanita Moldehnke', TO_DATE('04/21/2010 07:48:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('04/13/2010 12:39:04', 'MM/DD/YYYY HH24:MI:SS'), 30, 12541, '[email protected]', 81685, 81685);
    Insert into APPLSYS.FND_USER
       (USER_ID, USER_NAME, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, ENCRYPTED_FOUNDATION_PASSWORD, ENCRYPTED_USER_PASSWORD, SESSION_NUMBER, START_DATE, DESCRIPTION, LAST_LOGON_DATE, PASSWORD_DATE, PASSWORD_LIFESPAN_DAYS, EMPLOYEE_ID, EMAIL_ADDRESS, CUSTOMER_ID, PERSON_PARTY_ID)
     Values
       (2267, '[email protected]', TO_DATE('03/29/2010 11:13:59', 'MM/DD/YYYY HH24:MI:SS'), 2267, TO_DATE('11/24/2009 11:11:23', 'MM/DD/YYYY HH24:MI:SS'), 1295, 2267, 'ZH08DD1A68B37CAE173579A0B536B0B005F015185C3ED3E01C928F0990B602528C11560665E0EDB8EE8A666351A134D2D40C', 'ZHF50C9B4A60ED037DAD731FE2206B59B4F7305CD647BF6793AA859BB1DFFC18DCC823D6CF4DB43A94C5DBF696774FA37C00', 123, TO_DATE('11/24/2009 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Tanya Swanepoel', TO_DATE('04/21/2010 08:33:45', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('03/29/2010 11:13:59', 'MM/DD/YYYY HH24:MI:SS'), 30, 13003, '[email protected]', 92735, 92735);
    Insert into APPLSYS.FND_USER
       (USER_ID, USER_NAME, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, ENCRYPTED_FOUNDATION_PASSWORD, ENCRYPTED_USER_PASSWORD, SESSION_NUMBER, START_DATE, DESCRIPTION, LAST_LOGON_DATE, PASSWORD_DATE, PASSWORD_LIFESPAN_DAYS, EMPLOYEE_ID, EMAIL_ADDRESS, CUSTOMER_ID, PERSON_PARTY_ID)
     Values
       (2329, '[email protected]', TO_DATE('04/19/2010 14:33:11', 'MM/DD/YYYY HH24:MI:SS'), 2329, TO_DATE('03/02/2010 12:24:59', 'MM/DD/YYYY HH24:MI:SS'), 1295, 2329, 'ZHE12D2BA87DD3A97F7D17BBD5E5520F903D6C6C92B60021E3F065799E5D7DD3E163699B634050247C981BE0F8FDA81A1559', 'ZH1C22DD76D2FC5967ABFDDA4F3A5298CE9F774B061823C2F566E816C9EDB16F19225D62E85D4DB3FD73DC9DBACA2C7D2426', 91, TO_DATE('03/02/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Simangele Mhlongo', TO_DATE('04/21/2010 09:07:54', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('04/07/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 30, 6834, '[email protected]', 16126, 16126);
    Insert into APPLSYS.FND_USER
       (USER_ID, USER_NAME, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, ENCRYPTED_FOUNDATION_PASSWORD, ENCRYPTED_USER_PASSWORD, SESSION_NUMBER, START_DATE, DESCRIPTION, EMPLOYEE_ID, EMAIL_ADDRESS, PERSON_PARTY_ID)
     Values
       (2330, '[email protected]', TO_DATE('03/02/2010 12:27:42', 'MM/DD/YYYY HH24:MI:SS'), 1295, TO_DATE('03/02/2010 12:27:42', 'MM/DD/YYYY HH24:MI:SS'), 1295, 5737933, 'ZH61262B400C49CA3F72F7D5036FB5F33302093CCEFA1770AEF927F78222E10A615A4DD2B1F4D3AC7009E3A15879C7EADB70', 'ZH7B252AB5D0BA865795AF26CABD5CC6EBEF98458E3A82ECD11887E7EB89C7461BBE9C356753F88D35DF8B6CE7C0EDC062D3', 0, TO_DATE('03/02/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Sheilagh Lawlor', 3592, '[email protected]', 8475);
    Current SQL, I want too amendments:
    WITH t1 AS
    (SELECT CASE
    WHEN mm = '01'
    THEN tot
    ELSE 0
    END AS jan, CASE
    WHEN mm = '02'
    THEN tot
    ELSE 0
    END AS feb, CASE
    WHEN mm = '03'
    THEN tot
    ELSE 0
    END AS mar, CASE
    WHEN mm = '04'
    THEN tot
    ELSE 0
    END AS apr, CASE
    WHEN mm = '05'
    THEN tot
    ELSE 0
    END AS may, CASE
    WHEN mm = '06'
    THEN tot
    ELSE 0
    END AS jun, CASE
    WHEN mm = '07'
    THEN tot
    ELSE 0
    END AS jul, CASE
    WHEN mm = '08'
    THEN tot
    ELSE 0
    END AS aug, CASE
    WHEN mm = '09'
    THEN tot
    ELSE 0
    END AS sep, CASE
    WHEN mm = '10'
    THEN tot
    ELSE 0
    END AS oct, CASE
    WHEN mm = '11'
    THEN tot
    ELSE 0
    END AS nov, CASE
    WHEN mm = '12'
    THEN tot
    ELSE 0
    END AS DEC,
    mm,
    tot AS total
    FROM (SELECT TO_CHAR (CREATION_DATE, 'MM') mm, COUNT (1) AS tot
    FROM applsys.fnd_user@MAC1PROD_APPLSYS.MACSTEEL.COM
    WHERE creation_date > to_date('01-01-2010','DD-MM-YYYY')
    GROUP BY ROLLUP (TO_CHAR (CREATION_DATE, 'MM'))
    ORDER BY 1) a),
    t2 AS
    (SELECT SUM (jan) jan, SUM (feb) feb, SUM (mar) mar, SUM (apr) apr,
    SUM (may) may, SUM (jun) jun, SUM (jul) jul, SUM (aug) aug,
    SUM (sep) sep, SUM (oct) oct, SUM (nov) nov, SUM (DEC) DEC,
    SUM (CASE when mm IS NULL THEN total ELSE 0 END) AS total
    FROM t1)
    SELECT jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, total
    FROM t1
    UNION ALL
    SELECT jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, total
    FROM t2;
    This is the output current to make a selection above:
    JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC,TOTAL
     
    ----,----,----,----,----,----,----,----,----,----,----,----,-----
     
       2,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,    2
     
       0,   0,  18,   0,   0,   0,   0,   0,   0,   0,   0,   0,   18
     
       0,   0,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,    1
     
       0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   21
     
       2,   0,  18,   1,   0,   0,   0,   0,   0,   0,   0,   0,   21
    I would also add a total column as in this example:

    JAN, FEB, MAR, APR, MAY, JUNE, JULY, AUG, SEP, OCT, NOV, DEC, TOTAL

    ------------------------------------,----,----,----,----,----,----,----,----,----,----,----,----,-----

    4, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 6

    0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4
    TOTAL 4, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 10



    Any help will be much appreciated.
    Thank you

    Like this?

    SELECT
    NVL(TO_CHAR(extract(YEAR FROM creation_date)),'TOTAL') CREATION_YEAR,
    SUM(DECODE(extract (MONTH FROM creation_date),1,1,0)) JAN,
    SUM(DECODE(extract (MONTH FROM creation_date),2,1,0)) FEB,
    SUM(DECODE(extract (MONTH FROM creation_date),3,1,0)) MAR,
    SUM(DECODE(extract (MONTH FROM creation_date),4,1,0)) APR,
    SUM(DECODE(extract (MONTH FROM creation_date),5,1,0)) MAY,
    SUM(DECODE(extract (MONTH FROM creation_date),6,1,0)) JUN,
    SUM(DECODE(extract (MONTH FROM creation_date),7,1,0)) JUL,
    SUM(DECODE(extract (MONTH FROM creation_date),8,1,0)) AUG,
    SUM(DECODE(extract (MONTH FROM creation_date),9,1,0)) SEP,
    SUM(DECODE(extract (MONTH FROM creation_date),10,1,0)) OCT,
    SUM(DECODE(extract (MONTH FROM creation_date),11,1,0)) NOV,
    SUM(DECODE(extract (MONTH FROM creation_date),12,1,0)) DEC,
    SUM(1) total
    FROM applsys.fnd_user@MAC1PROD_APPLSYS.MACSTEEL.COM
    GROUP BY rollup(extract(YEAR FROM creation_date))
    
    CREATION_YEAR                                   JAN        FEB        MAR        APR        MAY        JUN        JUL        AUG        SEP        OCT        NOV        DEC      TOTAL
    ---------------------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
    2009                                              0          0          0          0          0       0     0          0          0          0          3          0          3
    2010                                              0          0          2          0          0       0     0          0          0          0          0          0          2
    TOTAL                                             0          0          2          0          0       0     0          0          0          0          3          0          5
    

    Check on pivot, if you have 11g

    http://www.orafaq.com/wiki/pivot

    SELECT NVL(TO_CHAR(extract(YEAR FROM creation_date)),'TOTAL') Creation_Year,
    NVL(SUM(JAN),0) JAN, NVL(SUM(FEB),0) FEB, NVL(SUM(MAR),0) MAR , NVL(SUM(APR),0) APR,
    NVL(SUM(MAY),0) MAY, NVL(SUM(JUN),0) JUN, NVL(SUM(JUL),0) JUL, NVL(SUM(AUG),0) AUG,
    NVL(SUM(SEP),0) SEP, NVL(SUM(OCT),0) OCT, NVL(SUM(NOV),0) NOV, NVL(SUM(DEC),0) DEC,SUM(1) Total
    FROM
         (SELECT creation_date,extract(MONTH FROM creation_date) cr_mon
         FROM applsys.fnd_user@MAC1PROD_APPLSYS.MACSTEEL.COM)
    pivot (SUM(1)
         FOR cr_mon IN (1 JAN,2 FEB,3 MAR,4 APR,5 MAY,6 JUN,7 JUL,8 AUG,9 SEP,10 OCT,11 NOV,12 DEC)
          )
    GROUP BY
    rollup(extract( YEAR FROM CREATION_date))
    
    CREATION_YEAR                                   JAN        FEB        MAR        APR        MAY        JUN        JUL        AUG        SEP        OCT        NOV        DEC     TOTAL
    ---------------------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
    2009                                              0          0          0          0          0       0     0          0          0          0          3          0          3
    2010                                              0          0          2          0          0       0     0          0          0          0          0          0          2
    TOTAL                                             0          0          2          0          0       0     0          0          0          0          3          0          5
    

    Kind regards
    Prazy

    Published by: Prazy on April 22, 2010 12:38
    Extra Pivot method

Maybe you are looking for

  • I had firefox. Updated gave me a malicious software. I uninstalled firefox. Is it now safe to re - install, details please.

    After an automatic upgrade for firefox 16 my search engine went to isearch Claro and would fail to withdrawal.Finally, I had to do a full restore and this seemed to cure the problem. I uninstalled firefox as a precaution but want to know if it can no

  • Problem starting Portege 7200 - stops running and the light flashes

    I have a portege 7200 with the docker dock 2 dvd, no problems until this weekend, when it stopped starting. its plugged into the power outlet and it starts the first windows 98 after the screen time, works my virus checker then the screen goes black,

  • Order "pending."

    IM an outsider of the United States, today I placed an order online, once it appeared that cancelled on motorola page, so I am in contact via webchat and support guy told me that the refund will be in 3-5 working days, and that he knew not why it was

  • Pavilion dv6-6c35dx pc: blue screen

    Signature of the problem Problem event name: BlueScreen OS version: 6.1.7601.2.1.0.768.3 Locale ID: 1033 Additional information about the problem BCCode: 116 BCP1: FFFFFA800E8CA4E0 BCP2: FFFFF880040EA80C BCP3: 0000000000000000 BCP4: 0000000000000002

  • Install Windows 7 on a Compaq Presario CG61 - driver for HARD drive

    Hello everyone, because of my Compaq Presario CQ61-423SG HARD drive (series: edited by moderator) broke (and with it the recovery partition), I would like to install a new Windows 7 (home premium, 64-bit) on the new HARD drive. Initially the program