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

Tags: Database

Similar Questions

  • 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.
     
  • 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

  • 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 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

    ;

  • 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

  • aid is the sql syntax

    Nice day

    someone help me if I replace (: 1 to & var, nn: = 1, 2', null) and execute sql when type 1.2 the work entry. the problem, I'm not want to used & var I want the value of assiagn at nn block and nn pass its value to: 1 whendo he says


    Note dep_id is the number


    ORA-06502: PL/SQL: digital or value error: character of number conversion error




    declare
    type m is ref cursor;
    CUR m;
    txt varchar2 (500);
    number of mm;
    NN varchar2 (20);
    Start
    nn: = 1, 2';
    txt: = q'[select count (*) from employees where dep_id in(*:1*))]';
    run immediately txt in mm using nn ;
    dbms_output.put_line ('nn =' | mm);
    end;
    /

    For your condition is the easiest way

    SQL> set serverout on
    SQL> DECLARE
      2    type m is ref cursor;
      3    cur m;
      4    txt varchar2(500);
      5    mm  number;
      6    nn  varchar2(20);
      7  BEGIN
      8    nn  := '20,30';
      9    txt := 'select count(*) from emp where deptno in ('||nn||')';
     10    execute immediate txt
     11      into mm;
     12      --using nn;
     13    dbms_output.put_line('nn= ' || mm);
     14  END;
     15  /
    nn= 11
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    However, if you want to implement varying IN history list and then completely different altogether. AskTom search for some examples.

  • 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

  • Using the SQL syntax

    I have two tables:

    status_lookup
    COL status_cd
    COL status_value


    state_transition
    COL from_status_cd
    COL to_status_cd

    The from_status_cd and the to_status_cd come from status_lookup.status_cd

    I know not how to get one or the other in a single query, but not both. For example:

    Select status_value from state_transition, status_lookup where from_status_cd = status_cd

    But, how to query the state_transition table such that I can get the status_value for each of the * status_cd of columns in a query?

    Edited by: jim.isConfused = true on October 12, 2009 13:32

    Just join twise research:

    select  from_status_cd,
            l1.status_value from_status_value,
            to_status_cd,
            l2.status_value to_status_value
      from  state_transition,
            status_lookup l1,
            status_lookup l2,
      where from_status_cd = l1.status_cd
        and to_status_cd = l2.status_cd
    /
    

    SY.

  • Change the SQL code

    Given that I do a UNION of 2 application directly on the tab ADVANCED. try to create "combine this claim with a similar request" but the filter does not pass because I use a DYNAMIC pivot table.

    If anyone can help or tell where to find information to achieve this.

    Thank you!
    Nora

    P.D.:forgive my English, but I am a translator

    Please close this thread and price points, if what I said helped. ;)

    Thank you!

  • Error: you have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ')' at line 5

    Original title: how to solve this problem:

    System error

    You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ')' at line 5

    Hi Roger,

    It seems that you have problems with the SQL syntax. The question you have posted is related to encoding and it would be better suited to the MSDN Community. Please report it in the community below.

    http://social.msdn.Microsoft.com/forums/SQLServer/en-us/home

    Hope this is useful.

  • Change the background color of the table rows af of those who have a larger date today

    Greetings,

    I have a table of af of insurance of the person which show details for each insurance policy. I have change the sql query table to show only those that the insurance is still active ('end_date' variable is greater than today).

    Everything works fine, but on doubts, I want to show all the records, but change the background color red of those lines which have expired ('end_date' variable less today).

    Can you help me please?

    Thanks in advance.

    Using Jdeveloper v11.1.2.4.0 (JSF - components of the ADF)

    This example shows how to do this http://andrejusb.blogspot.de/2010/04/changed-row-highlighting-in-oracle-adf.html

    Timo

Maybe you are looking for

  • The mixed content not recalled blocking preferences

    I want to disable way permanent blocking of mixed content on some Web sites. When I click "Disable on this page protection", Firefox seems to remember the choice until the end of the session. After reboot, I disable it again. Is there a way to rememb

  • Help! WRT110 loses connectivity with the portable 2 Vista logon @ times!

    Equipment: Laptop #1: HP DV6338se (wife, owner for more than a year)-1.8 GHz AMD Turion64 X 2 Dual-Core Mobile Technology TL-56-1024 MB DDR2 memory-NVIDIA GeForce Go 6150 (UMA)-NVIDIA nForce Chipset-Modem 56 k Conexant High speed-Ethernet 10/100 inte

  • Missing telemetry.dll

    On opening a document to Adobe pdf, I get the error message "AcroRd.exe - System Error... Telemetry.dll is missing... ».  If I click 'OK' twice or three times, the error message disappears.  I don't know why it's the sudden appearance.  I was warned

  • Signature of applications from a new machine &amp; Blackberry ID

    I saved ALL the things from my old machine and copied to a new computer. And spin ONLY under the control of my new machine which gives following error. This command works fine from my old machine, but NOT of my new machine. batchbar - sign/workspace/

  • says that my operating system is fake.

    computer was shipped with windows vista. I had a reason to upgrade my operating system to windows 7. has been contacted by internet that my copy was false.  JG