using the query - group

Hi all
I need to get the sum (sal) and the sum (comm) using the select query...
I use a group of... but could not get the result...
For example... If the table is
ENO ename sal comm deptno job
1234 2000 1 10 Chief john
1235 1000 2 20 andrew seller
1236 2000 3 20 steven Manager
Clerk robert 1237 600 4 10
Manager of laura 1238 2000 5 20
1239 500 6 30 dan seller
1240 500 7 10 james clerk

I need display all the columns in the select query and the result should be as follows:
ENO ename sal comm deptno sum (sal) sum (comm) employment
1234 2000 1 10 6000 9 Chief john
1235 1000 2 20 1500 8 andrew seller
1236 2000 3 20 6000 9 steven Manager
Clerk robert 1237 600 4 10 1100 11
1238 2000 5 20 6000 9 laura Manager
1239 500 6 30 1500 8 dan seller
1240 500 7 10 1100 11 james clerk

I appreciate your help... Thank you!

Use anaytic SUM:

SQL> select  empno,
  2          ename,
  3          job,
  4          sal,
  5          comm,
  6          deptno,
  7          sum(sal) over(partition by deptno) sum_sal,
  8          sum(comm) over(partition by deptno) sum_comm
  9    from  emp
 10  /

     EMPNO ENAME      JOB              SAL       COMM     DEPTNO    SUM_SAL   SUM_COMM
---------- ---------- --------- ---------- ---------- ---------- ---------- ----------
      7782 CLARK      MANAGER         2450                    10       8750
      7839 KING       PRESIDENT       5000                    10       8750
      7934 MILLER     CLERK           1300                    10       8750
      7566 JONES      MANAGER         2975                    20      10875
      7902 FORD       ANALYST         3000                    20      10875
      7876 ADAMS      CLERK           1100                    20      10875
      7369 SMITH      CLERK            800                    20      10875
      7788 SCOTT      ANALYST         3000                    20      10875
      7521 WARD       SALESMAN        1250        500         30       9400       2200
      7844 TURNER     SALESMAN        1500          0         30       9400       2200
      7499 ALLEN      SALESMAN        1600        300         30       9400       2200

     EMPNO ENAME      JOB              SAL       COMM     DEPTNO    SUM_SAL   SUM_COMM
---------- ---------- --------- ---------- ---------- ---------- ---------- ----------
      7900 JAMES      CLERK            950                    30       9400       2200
      7698 BLAKE      MANAGER         2850                    30       9400       2200
      7654 MARTIN     SALESMAN        1250       1400         30       9400       2200

14 rows selected.

SQL> 

SY.

Tags: Database

Similar Questions

  • Inserting data by using the query

    Hello

    In a book, I read the Sub statement:

    Inserting data by using the query (DML)

    If the user wants to transfer data from a table to another table in the insert statement are used independently of data that can be processed or not processed form.

    Can someone clarify what is the significance of this (processed or unprocessed form).


    Thank you.

    Why don't you ask the author of the book.

    How can we know what the author means when you take a quote out of context and don't provide any reference so that we can see exactly what is shown to you.

    I can only imagine that they are referring to data that are queried directly, "like what", another table, or who was interrogated and manipulated before be inserted.

  • the search for empty cells by using the query designer

    Hello

    I'm trying to exclude empty cells in a field (by using the Query Builder), and I did:

    xDocumentSource < match > "CDL".

    < AND >

    < NOT > (xRelatedMsgid < match > "" "")

    but it does not work. I tried "NULL", but it does not work either. Could someone tell me how to do it (or where I can find examples of queries).

    Kind regards

    Iwona

    https://blogs.Oracle.com/Kyle/entry/searching_for_null_values_ucm

  • List of virtual machines in TIME using the query service

    Someone been able to use the query service to produce a range of virtual machines in a paralytic? I don't see all the attributes on the VclQueryadminVMField that reference the vApp.

    I log in the org of system.

    Any help would be appreciated.

    Name of the action: getVAppVms

    Entry: VAPP (vCloud:VApp)

    Output: Array / vCloud:VM

    Script:

    var vcdHost = vApp.getHost();
    var vms = new Array();
    
    var queryService = vcdHost.getQueryService();
    expression = new VclExpression(VclQueryVMField.CONTAINER, vApp.getReference().href, VclExpressionType.EQUALS);
    filter = new VclFilter(expression);
    params = new VclQueryParams();
    params.setFilter(filter);
    
    var resultSet = queryService.queryRecords(VclQueryRecordType.VM, params);
    while (resultSet != null) {
        var records = resultSet.getRecords(new VclQueryResultVMRecord());
        System.log(records.length + " VM records found");
        for each (var record in records) {
         var vmRef = new VclReference();
         vmRef.href = record.href;
         vmRef.name = record.name;
         vmRef.type = record.type;
         vms.push(vcdHost.getEntityByReference(VclEntityType.VM, vmRef));
        }
        resultSet = resultSet.getNextPage();
    }
    
    return vms;
    

    This is what made our team (more precisely - Christophe)

  • Using the QUERY parameter in exp/expdp

    Hi, I've faced a nite last question.
    IM currently using Oracle 10 g (10.2.0.4) OS - MS Windows Server 2003

    I want a dump of tables to export multiple schemas. say (acb.m1, pqr.b2, xyz.b1)

    Each table has a minimum lines of 2,000,000,

    And I want to just the initials 10 rows in each table of export

    Is it possible that I can do this...

    Please answer.
    Thanks in advance

    Export tables in multiple schemas is not supported in Data Pump until 11.1.0.7. So if you're on 10g, you will need to run multiple commands expdp. For only 10 lines of each table, use the query parameter

    Query = "where rownum"<>

    This will apply to all the tables you export.

    I hope this helps.

    Dean

    Published by: Dean WINS January 30, 2012 08:42

  • Not able to change the password by using the query. Select APPS.fnd_web_sec

    Not able to change the password by using the query.
    Select APPS.fnd_web_sec.change_password ('username', 'password') 'RES' double;

    Can someone tell why and what privileges and subsidies have flexibility to the user non-apps while it can change the password using fnd_web_sec.change_password.



    Concerning

    the information above does not solve my problem, I get the message

    Because you do not have permission on all objects that are referenced by the API (see below).

    Select FND_WEB_SEC. CHANGE_PASSWORD ('MARSHAD', 'mohammad @123') "RES" of the double

    *

    ERROR on line 1:

    ORA-00942: table or view does not exist

    ORA-06512: at the 'APPS '. FND_CORE_LOG', line 25

    ORA-06512: at the 'APPS '. FND_CORE_LOG', line 432

    ORA-06512: at the 'APPS '. FND_PROFILE', line 110

    ORA-06512: at the 'APPS '. FND_SSO_MANAGER", line 227

    ORA-06512: at the 'APPS '. FND_WEB_SEC', line 1425

    ORA-06512: at line 1...

    can you please list me what are the grants and other Jules Destrooper I should give to a user so that he can change password.

    I don't have the list of objects and you should get yourself by consulting the site code and eTRM API.

    by changing the DDT in the user non-apps after the grant, will, it may be able to change the password.please tell this syntax is correct or not.
    Select applications. FND_WEB_SEC. CHANGE_PASSWORD ('user', 'pwd') "RES" of the double

    What is the point of using 'FND_WEB_SEC. CHANGE_PASSWORD' and not FNDCPASS or FND_USER_PKG API?

    Thank you
    Hussein

  • DataPump import by using the query

    Hello

    I need to import data by filtering using the query. can anyone help?

    Thank you

    Hello
    example of

    expdp HR/hr = emp QUERY:'"WHERE dept_id > 10 AND sal > 10000"' NOLOGFILE = y DIRECTORY = dpump_dir1 DUMPFILE = exp1.dmp

    Impdp HR/hr DIRECTORY = dpump_dir1 DUMPFILE = expfull.dmp QUERY = departments:'WHERE department_id «»< 120"'="" nologfile="">

    See this link

    http://download.Oracle.com/docs/CD/B13789_01/server.101/b10825/dp_import.htm

  • IMPDP | Possible using the query option

    HI PPL,

    I wanted to know if IMPDP is possible by using the query option, as I took full expdp dump of the mentioned table and want to import only select lines.

    Impdp arup/arup directory = demo_dir dumpfile = employees.dmp
    Query = employees:------"" where salary\ > 10000\ order of salary "tables used ="

    version: 10 gr 2
    platform: UNIX

    concerning

    Obviously, it will be slow if you are using the query option, because IMPDP must import only the data that meets the criteria; It of why we export only limited data (one or two tables as needed) and import them completely.

    Concerning
    Girish Sharma

  • Problem in the export using the QUERY functionality

    Problem in the export using the QUERY functionality


    I'm trying to export some rows in a table using the query functionality
    and I have some errors... I'm using the syntax is

    system@orcl QUERY = scott.emp expdp: '"WHERE emp_no = 123455" '
    DIRECTORY = data_pump_dir DUMPFILE = data_pump.dmp
    LOGFILE = data_pump_12345.log INDEX = n

    Can someone tell me please the problem with that statement

    I also tried to use the simple export

    exp file system@orcl = orcl_export.dmp log = orcl_export.log
    tables = Scott.EMP index = QUERY = n------"WHERE emp_no\ = 123455\"

    and this error

    EXP-00008: ORACLE error 904
    ORA-00904: identify invalid

    My os is Solaris
    Please let me know what the problem

    Hello

    Try to create parfile and use that, otherwise, you will need to escape each clause correctly to run exp or expdp successfully.

    test.par

    tables=emp
    query="WHERE emp_no=123455"
    
    or
    tables=myobjects
    query="WHERE owner='SYS'"
    
    $> exp username/password parfile=test.par
    
    Export: Release 10.2.0.1.0 - Production on Thu Mar 19 10:17:48 2009
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining Scoring Engine options
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    
    About to export specified tables via Conventional Path ...
    . . exporting table                      MYOBJECTS      22650 rows exported
    Export terminated successfully without warnings.
    

    Concerning

    Published by: OrionNet on March 19, 2009 10:21

  • Using the query to get the group by rollup subtotal

    Hello

    Expected output is, for 'chris' each record must have subtotal row because it has different 'no' of the column values.

    For 'John' the subtotal came as planned because she didn't even.

    Could you please correct the query for "chris" below!

     select   
    case when nm is null then 'Total'  
         when no is null then 'Subtotal'  
         else nm  
    end nm,no,emplmt,profund,status,dt,sal,days,intrst,intrs1,intrs2  
    from   
    (  
        with t as     
            (select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('01/22/2014','mm/dd/yyyy') dt , 2456 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual    
            union all    
            select 'chris' nm , 20 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('01/03/2014','mm/dd/yyyy') dt , 1000 sal, 30 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual    
            union all    
            select 'chris' nm , 30 no ,'FT' Emplmt, 'PF' ProFund , 'NonReg' Status ,to_Date ('01/01/2014','mm/dd/yyyy') dt , 20 sal, -5 days , 1 intrst ,1 intrs1 ,1 intrs2 from dual    
           union all
           select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/02/2014','mm/dd/yyyy') dt , 1153 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual    
            union all    
            select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/16/2014','mm/dd/yyyy') dt , 1000 sal, 8 days , 40 intrst ,45 intrs1 ,50 intrs2 from dual    
    
    
           )    
        select nm,no,emplmt,profund,status,dt,sum(sal)sal,sum(days)days,sum(intrst)intrst,sum(intrs1)intrs1,sum(intrs2)intrs2  
        from t  
        GROUP BY ROLLUP (nm,no,emplmt,profund,status,dt)  
        order by nm,no,emplmt,profund,status,dt  
    )  
    where (no is not null and emplmt is not null and profund is not null and status is not null and dt is not null)  
    or (no is null and emplmt is null and profund is null and status is null and dt is null)  
    

    allows us to use grouping sets to produce just the totals you want.

    with t as

    (select "chris" nm1, 10 no1, "Pi" Emplmt, "PF" ProFund "Reg" Status, to_Date (January 22, 2014 "," mm/dd/yyyy") dt, 2456 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double)

    Union of all the

    Select No, the "chris" nm, 20 'ft' Emplmt, "PF" ProFund "Reg" Status, to_Date (3 January 2014 "," mm/dd/yyyy") dt, intrst 50, intrs1 55, 1000 sal, 30 days, 60 intrs2 of the double

    Union of all the

    Select "chris" nm, 30 no, "Pi" Emplmt, ProFund "PF", "NonReg" State, to_Date (January 1, 2014 "," mm/dd/yyyy") dt, 20 sal,-5 days, 1 intrst, 1 intrs1, 1 intrs2 of the double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (May 2, 2014 "," mm/dd/yyyy") dt, 1153 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (16 may 2014 "," mm/dd/yyyy") dt, 1000 sal, 8 days, intrst 40, 45 intrs1, 50 intrs2 of the double

    )

    SELECT

    CASE

    WHEN grouping (nm1) = 1

    THEN "Total".

    WHEN grouping (emplmt) = 1

    THEN "Subtotal".

    Of ANOTHER nm1

    END nm,

    CASE

    WHEN grouping (emplmt) = 1

    THEN NULL

    Of ANOTHER no1

    END no emplmt, profund, status, dt, sal SUM (sal), SUM (days) days, SUM (intrst) intrst, SUM (intrs1) intrs1, intrs2 SUM (intrs2)

    T

    GROUP BY Grouping SETS ((), (nm1, no1), (nm1, no1, emplmt, profund, status, dt))

    ORDER BY nm1, no1, emplmt, profund, status, dt

    NM               NO EM PR STATUS DT              SAL       DAYS     INTRST     INTRS1     INTRS2 chris            10 FT PF Reg    22.01.14       2456         10         50         55         60 Subtotal                                        2456         10         50         55         60chris            20 FT PF Reg    03.01.14       1000         30         50         55         60 Subtotal                                        1000         30         50         55         60chris            30 FT PF NonReg 01.01.14         20         -5          1          1          1 Subtotal                                          20         -5          1          1          1john             11 PT PF Reg    02.05.14       1153         10         50         55         60 john             11 PT PF Reg    16.05.14       1000          8         40         45         50Subtotal                                        2153         18         90        100        110 Total                                           5629         53        191        211        231 
    
  • How can improve on the slow update using the query / * + NO_XML_DML_REWRITE * /?

    We have an update query recently brought to my attention that turns very slowly on Oracle 11.2.0.1 against a secure XML binary files table using

    Update / * + NO_XML_DML_REWRITE * / set object_value = croutreach.action: 1 where actn_id =: 2.
    I am told the majority/close to the majority of the ~ 16 fields are updated. This table has also many predefined virtual columns with index fn based on them.

    My first inclination was to this redesign using updatexml Oracle. I was told, the / * + NO_XML_DML_REWRITE * / index would also be required here.

    Update / * + NO_XML_DML_REWRITE * /.
    < tble_name > a
    Set a.object_value = updatexml (a.object_value...).

    Last year our dba have been mandated by Oracle Support to use this trick, as the update has not been updated off any msgs of error records.

    + 1. Hoping to find out if anyone met with this indication in some capacity and what has their experience been? +

    Trying to optimizie this update statement, I'll start from scratch is not using the / * + NO_XML_DML_REWRITE * / hint and will take effect in using the updatexml with establishing a xmlindex.

    + 2. Hoping to receive suggestions on creating the good xmlindex - find an informal index. If getting a few good performance with the xmlindex; in an attempt to remove some of the use of the virtual column. +

    + 3. Any suggestions on living with virtual columns in conjunction with xmlindexes? See the definition of table action and Associates ivirtual columns and indexes. This picture seems more indexed... +.
    REATE
      TABLE "CROUTREACH"."ACTION" OF XMLTYPE
      (
        CONSTRAINT "ACTN_ID_PK" PRIMARY KEY ("ACTN_ID") USING INDEX PCTFREE 10
        INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT
        1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1
        FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE
        DEFAULT) TABLESPACE "ACME_DATA" ENABLE
      )
      XMLTYPE STORE AS SECUREFILE BINARY XML
      (
        TABLESPACE "ACME_DATA" ENABLE STORAGE IN ROW CHUNK 8192 CACHE READS LOGGING
        NOCOMPRESS KEEP_DUPLICATES STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1
        MAXEXTENTS 2147483645 PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
        CELL_FLASH_CACHE DEFAULT)
      )
      ALLOW NONSCHEMA ALLOW ANYSCHEMA VIRTUAL COLUMNS
      (
        *"ACTION_DEF_URN"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                 
    /action/srvContextPointer/outreachActionDefInfo/@actionDefUrn                                               
    '
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"STAT_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
        SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/@status_dt'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
    WITH
      TIME ZONE))),
        *"ACT_DEF_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/srvContextPointer/outreachActionDefInfo/@actionDefId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(20))),
        *"CORRL_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/correlationId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"STAT_RSN"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                                  
    /action/statusReason'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(30))),
        *"ACT_APPNT_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
        SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                  
    /action/actionAppointment/appointment_dt'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
    WITH
      TIME ZONE))),
        *"UPDT_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
        SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/@update_dt'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
    WITH
      TIME ZONE))),
        *"CRET_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
        SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/@create_dt'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
    WITH
      TIME ZONE))),
        *"ACT_SEQ"* AS (CAST(TO_NUMBER(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                    
    /action/srvContextPointer/outreachActionDefInfo/@sequence'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2)) AS NUMBER(10))),
        *"SERVICE_DEF_URN"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";                                                          
    /action/srvContextPointer/serviceDefUrn'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(100))),
        *"ASSIGN_TEAM_CD"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                  
    /action/assignment/@teamCategoryCode'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"ASSIGN_STAFF_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                  
    /action/assignment/staffProfileId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"ACTION_TYPE"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                      
    declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; (::)                                                      
    local-name-from-QName(QName("http://www.cigna.com/acme/domains/actions/2010/03",/action/@xsi:type))                                                                  
    '
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"ACTN_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";/action/@id'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"STATUS"*AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";/action/@status'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(20))),
        *"ACME_MBR_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";/action/acmeMemberId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50)))
      )
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
      (
        INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
        FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
        CELL_FLASH_CACHE DEFAULT
      )
      TABLESPACE "ACME_DATA" ;
    CREATE UNIQUE INDEX *"CROUTREACH"."SYS_C0014547"* ON "CROUTREACH"."ACTION"
      (
        "SYS_NC_OID$"
      )
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
      (
        INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
        FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
        CELL_FLASH_CACHE DEFAULT
      )
      TABLESPACE "ACME_DATA" ;
    CREATE UNIQUE INDEX *"CROUTREACH"."SYS_IL0000082156C00003$$"* ON "CROUTREACH".
      "ACTION"
      (
        PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576
        MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST
        GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
        TABLESPACE "ACME_DATA" PARALLEL (DEGREE 0 INSTANCES 0) ;
    CREATE UNIQUE INDEX *"CROUTREACH"."ACTN_ID_PK"* ON "CROUTREACH"."ACTION" (
      "ACTN_ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(
      INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
      FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
      CELL_FLASH_CACHE DEFAULT) TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_STAT_RSN_IDX"* ON "CROUTREACH"."ACTION"
        (
          "STAT_RSN"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_UPDT_DT_IDX"* ON "CROUTREACH"."ACTION"
        (
          "UPDT_DT"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_CRET_DT_IDX"* ON "CROUTREACH"."ACTION"
        (
          "CRET_DT"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_STAT_DT_IDX"* ON "CROUTREACH"."ACTION"
        (
          "STAT_DT"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_MBRID_TYP_STAT_IDX"* ON "CROUTREACH"."ACTION"
        (
          "ACME_MBR_ID",
          "ACTION_TYPE",
          "STATUS"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACT_ACTDEF_URN_IDX"* ON "CROUTREACH"."ACTION"
        (
          "ACTION_DEF_URN"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_ACT_DEF_ID_STATUS_IDX"* ON "CROUTREACH"."ACTION"
        (
          "ACT_DEF_ID",
          "STATUS"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
    Any suggestions much appreciated.

    Kind regards
    Richard Blanchard

    Hi Rick,

    Thanks for adding the sample.

    First note: you use namespaces by default, different in the example of XML and the request - this a misspelling due to your mask real names?

    In any case, I see two problems with the UPDATE statement:

    (1) unless it is really part of the id, do not double-cover the value:

    @id="'888a80be-d69f-464d-b3f7-85b6209f918e'"
    

    must be:

    @id="888a80be-d69f-464d-b3f7-85b6209f918e"
    

    or as a variable binding (see below)

    (2) just like other XML features, XMLExists supports the names. You must declare any namespace as you lower to use XQuery in the expression (in this case, the default namespace).

    It works for me:

    SQL> create table action of xmltype
      2  xmltype store as securefile binary xml
      3  ;
    
    Table created.
    
    SQL> insert into action
      2  values (
      3   xmltype('
      4  
     13     abcdefghijklmnop
     14     qrstuvwxyz
     15     
     16        urn:coderunner:Medical:Definition:ServiceService:11111:7
     17        
     18           Access Profile~Why did you access the profile?~Reason for access?
     19        
     20     
     21  ')
     22  );
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> UPDATE action
      2  SET object_value =
      3      updatexml( object_value
      4               , '/action/@status'
      5               , 'triggered'
      6               , 'xmlns="http://www.xxxxxx.ddd/mmm/domains/actions/2010/03"' )
      7  WHERE XMLExists( 'declare default element namespace "http://www.xxxxxx.ddd/mmm/domains/actions/2010/03"; (::)
      8                   /action[@id=$action_id]'
      9                   passing object_value
     10                         , 'dfdfdfdfdfddfdfdfdfdfdf' as "action_id"
     11                   )
     12  ;
    
    1 row updated.
    
    SQL> SELECT XMLCast(
      2           XMLQuery('declare default element namespace "http://www.xxxxxx.ddd/mmm/domains/actions/2010/03"; (::)
      3                     /action/@status'
      4                     passing object_value returning content)
      5           as varchar2(30)
      6         ) as status
      7  FROM action
      8  ;
    
    STATUS
    ------------------------------
    triggered
    
  • Using the query - amount weekly, daily, max &amp; time

    Hi guys,.

    I came looking for help with this query, I should use to create a new table. At first I just thought I needed to store the weekly amount and some other information, but then told me that I need the sum for the week and the hourly figure higher this week with time. I managed to make all columns except rush hour causing me issues.

    The DESC table is as follows: http://i38.tinypic.com/8yt0.png

    My query result has need of the following:
    Db_name (direct copy of the table)
    TYPE (direct copy of the table)
    YEAR (cropped from TD_HR - first 4 characters)
    WEEK (cropped from TD_HR and then converted to the IW format)
    TOTAL (weekly column TOTAL amount)
    HOURLY_PEAK (the largest AMOUNT for a given time during a week)
    PEAK_TIME (time of the highest sum for the week)

    I have everything show except PEAK_TIME. Sample data:
    DB_NAME     TD_HR             TOTAL   TYPE
    CSAHEPA     2008-07-24 16     35     CON
    CSAHEPA     2008-07-24 15     4     CON
    CSAHEPA     2008-07-24 16     19     CON
    CSAHEPA     2008-07-24 17     3651     CON
    CSAHEPA     2008-07-24 16     7     CON
    CSAHEPA     2008-07-24 17     113     CON
    CSAHEPA     2008-07-24 17     534     CON
    CSAHEPA     2008-07-24 17     289     CON
    CSAHEPA     2008-07-24 17     12     CON
    CSAHEPA     2008-07-24 16     52     CON
    My current (terribly inefficient) query is the following:
    select DB_NAME, YEAR, WEEK, sum(SUM), TYPE, sum(WEEKLY_PEAK) from (
    select DB_NAME, SUBSTR(TD_HR, 1, 4) year, to_char(to_date(SUBSTR(TD_HR, 1, 10), 'RRRR-MM-DD'), 'IW') week, sum(TOTAL) sum, TYPE, 0 WEEKLY_PEAK
    from CORCON01_HOUR_CHG_TOTALS
    group by DB_NAME, SUBSTR(TD_HR, 1, 4), to_char(to_date(SUBSTR(TD_HR, 1, 10), 'RRRR-MM-DD'), 'IW'), TYPE
    union all
    select db_name, year, week, 0 sum, type, max(peak) weekly_peak from (
    select DB_NAME, SUBSTR(TD_HR, 1, 4) year, to_char(to_date(SUBSTR(TD_HR, 1, 10), 'RRRR-MM-DD'), 'IW') week, TYPE, sum(total) peak, CONCAT(INITCAP(TO_CHAR(TO_DATE(rpad(td_hr, 10),'yyyy-mm-dd'),'dy')), substr(td_hr,11))||':00' peak_time
    from CORCON01_HOUR_CHG_TOTALS
    group by DB_NAME, SUBSTR(TD_HR, 1, 4), to_char(to_date(SUBSTR(TD_HR, 1, 10), 'RRRR-MM-DD'), 'IW'), TYPE, CONCAT(INITCAP(TO_CHAR(TO_DATE(rpad(td_hr, 10),'yyyy-mm-dd'),'dy')), substr(td_hr,11)))
    group by db_name, year, week, type)
    group by db_name, year, week, type
    The final column data are given in the 2nd query here as:
    CONCAT (INITCAP (TO_CHAR (TO_DATE (rpad (td_hr, 10), "yyyy-mm-dd"), "dy")), substr(td_hr,11)) |': 0 0' peak_time
    Any help (get the last column included and/or improvement of the effectiveness of the query) is greatly appreciated.

    Mike

    This?

    with  results as (select db_name,
                             to_date(td_hr, 'yyyy-mm-dd hh24') td_hr,
                             total,
                             type
                      from   CORCON01_HOUR_CHG_TOTALS),
    final_results as (select db_name,
                             td_hr,
                             type,
                             sum(total) sum_total
                      from   results
                      group by db_name,
                               td_hr,
                               type)
    select db_name,
           to_char(td_hr, 'yyyy') year,
           to_char(td_hr, 'iw') week,
           type,
           sum(sum_total) week_sum_total,
           max(sum_total) peak_sum_total,
           to_char(max(td_hr) keep (dense_rank first order by sum_total desc), 'yyyy-mm-dd hh24') peak_hour
    from   final_results
    group by db_name,
             to_char(td_hr, 'yyyy'),
             to_char(td_hr, 'iw'),
             type;
    
    DB_NAME          YEAR WEEK TYPE       WEEK_SUM_TOTAL PEAK_SUM_TOTAL PEAK_HOUR
    ---------------- ---- ---- ---------- -------------- -------------- -------------
    CSAHEPA          2008 30   CON                  4716           4599 2008-07-24 17
    CSAHEPA          2008 39   CON                   611            555 2008-09-24 16
    

    (And why, oh why, you store your dates as VARCHAR2?) ({noformat} * sobs * {noformat})

  • FRM - 40212 / FRM - 40222 error on a radio during the query group

    Hi all

    This is my first post, so please bear with me if I did not provide enough information or am not clear at all.

    I use Forms Builder (Web) on a 10g database. I have a number of databases and elements non-base of data as part of a block of data.
    My problem is that when I enter a value in a field and click the query button, I have an invalid value FRM-40212 for error field on my radio group (section disabled, non-base of data, which is populated by programming in the triggers of post requests and amended list only). When I click ok, I get an error of FRM-40222 disabled point Validation failure on the same radio group.

    This does not happen if I click on the button "Enter the query" before you enter values in the fields, but I don't want my users to encounter this error if they try to interrogate without clicking "Enter the query" first.

    I would like to know why exactly this error happens - what it means?
    I read in other forums that setting the required article property to false solves this problem. But how can I do this with a group of radio buttons? And if it is not possible, anyone have any suggestions for other workaround solutions?

    Thanks in advance,

    Abigail

    Hello

    You can avoid this by defining "Mapping of other values" to a fo value of radio buttons. As if you need to radio radio1 and radio2 associated group R1 radio button, then set the option buttons the initial value of this property to 'Mapping of other values' radio button R1. You will not see this error.

    This error occurs because as your loading a screen without assigning a value to the option button.

    If this helps brand question as answer or useful.

    Thank you
    Pavan.

  • SSL VPN authentication using the ad group

    Hi all

    I tried to restrict users to authenticate to the SSL VPN using an ad server. I have install the AAA server with the IP address of the AD server and attributed to the connection profile as well; However, I see that any user who is a member of a group in AD is able to authenticate.

    I want to only users who belong to the group "VPN users" get authenticated while everyone and all those who have credentials of the AD and not even a part of the 'VPN users' group is making authenticated.

    Can someone advice how I can make the ASA authenticate users based on ad groups? I use the ASDM to configure my VPN RA.

    Thanks in advance!

    Kind regards

    Riou

    Hey riri,.

    Try to use DAP to restrict access to users who belong to a specific ad group:

    https://supportforums.Cisco.com/document/7691/ASA-8X-dynamic-access-poli...

    Use the AAA attribute "LDAP .member of" to allow access to the users belonging to a specific group and deny access to other users.

    concerning

    Eric

  • Retrieve the screen VCD ticket using the query service

    Good afternoon.

    Anyone has any advice on the recovery of the url of the post screen for a virtual machine by using the VCD query service?

    Thre is a wonderful post on VirtuallyGhetto on how to retrieve this pure REST help, but I can't translate to VCO.

    Any help would be greatly appreciated.

    Have you checked the workflow 'Acquire a ticket' in the library?

    Christophe.

Maybe you are looking for