Need help creating a query XMLTABLE

I'm fairly new to XML parsing in Oracle and am struggling to write correctly a XMLTABLE query that can parse the XML response from a SOAP Web service. I read some documents, but nothing seems to cover the kind of disorder that below, I'm working with.

If there is someone who has the experience to deal with this kind of SOAP response, any help would be greatly appreciated. I think I'm not declaring namespaces correctly.

Here is the command that I have so far, which is far from running:
select *
from XMLTABLE(xmlnamespaces(
    'http://www.w3.org/2003/05/soap-envelope/' as "soapenv"
   ,'http://<server>/webservice/soap/server.php?wstoken=LONGENCRYPTEDTOKEN' as "ns1"
   ,'http://xml.apache.org/xml-soap' as "ns2"
   ,'http://www.w3.org/2003/05/soap-encoding' as "enc"
   ,'http://www.w3.org/2003/05/soap-rpc' as "rpc"
),
'/soapenv:Envelope/soapenv:Body/ns1:moodle_course_create_coursesResponse/rpc:result/ns2:item'
PASSING ('XML SHOWN BELOW')
COLUMNS
    ID VARCHAR2(10) PATH '???????') a
Here's the sanitized XML code:
<?xml version="1.0" encoding="UTF-8"?>
            <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
                          xmlns:ns1="http://<server>/webservice/soap/server.php?wstoken=LONGENCRYPTEDTOKEN"
                          xmlns:ns2="http://xml.apache.org/xml-soap"
                          xmlns:enc="http://www.w3.org/2003/05/soap-encoding"
                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                <env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">
                    <ns1:moodle_course_create_coursesResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
                        <rpc:result>return</rpc:result>
                        <return enc:itemType="ns2:Map" enc:arraySize="2" xsi:type="enc:Array">
                            <item xsi:type="ns2:Map">
                                <item>
                                    <key xsi:type="xsd:string">id</key>
                                    <value xsi:type="xsd:int">14756</value>
                                </item>
                                <item>
                                    <key xsi:type="xsd:string">shortname</key>
                                    <value xsi:type="xsd:string">testname5</value>
                                </item>
                            </item>
                            <item xsi:type="ns2:Map">
                                <item>
                                    <key xsi:type="xsd:string">id</key>
                                    <value xsi:type="xsd:int">14757</value>
                                </item>
                                <item>
                                    <key xsi:type="xsd:string">shortname</key>
                                    <value xsi:type="xsd:string">testname6</value>
                                </item>
                            </item>
                        </return>
                    </ns1:moodle_course_create_coursesResponse>
                </env:Body>
            </env:Envelope>

Hello

SOAP-RPC is delicate, that the name of the resultset object is given in a separate element.

Here, you will need to do this:

SQL> var xmlresp clob
SQL> BEGIN
  2   :xmlresp :=
  3  '
  4  
 10      
 11          
 12              return
 13              
 14                  
 15                      
 16                          id
 17                          14756
 18                      
 19                      
 20                          shortname
 21                          testname5
 22                      
 23                  
 24                  
 25                      
 26                          id
 27                          14757
 28                      
 29                      
 30                          shortname
 31                          testname6
 32                      
 33                  
 34              
 35          
 36      
 37  ';
 38  END;
 39  /

PL/SQL procedure successfully completed.

SQL> SELECT x.*
  2  FROM XMLTable(
  3         XMLNamespaces(
  4           'http://www.w3.org/2003/05/soap-envelope' as "soapenv"
  5         , 'http://server/webservice/soap/server.php?wstoken=LONGENCRYPTEDTOKEN' as "ns1"
  6         , 'http://xml.apache.org/xml-soap' as "ns2"
  7         , 'http://www.w3.org/2003/05/soap-encoding' as "enc"
  8         , 'http://www.w3.org/2003/05/soap-rpc' as "rpc"
  9         )
 10       , 'for $i in /soapenv:Envelope/soapenv:Body/ns1:moodle_course_create_coursesResponse
 11          return $i/*[name()=$i/rpc:result]/item'
 12          PASSING xmltype(:xmlresp)
 13          COLUMNS id        VARCHAR2(10) PATH 'item[key="id"]/value'
 14                , shortname VARCHAR2(30) PATH 'item[key="shortname"]/value'
 15       ) x
 16  ;

ID         SHORTNAME
---------- ------------------------------
14756      testname5
14757      testname6

BTW, you do not have to declare every single document, just namespace (s) you intend to use in the statement.

Tags: Oracle Development

Similar Questions

  • Need help with a query result

    Oracle Version: 11.2.0.2.0

    I need assistance with the output of the query. Here is the table.

    With Tbl_Nm as

    (

    Select 'ABC1' SYSTEM_ID, REGION 'US', 'CHI' SUB_REGION 4000 BALANCE, to_date('1-JUN-2012 10:45:00 am', 'dd-mon-yyyy hh:mi:ss am') LAST_UPD_TIME, 'A' FLAG of union double all the

    Select 'PQR2', 'UK', 'LN', 2000, To_Date('1-JUL-2012 10:46:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select 'ABC1', 'IND","MAMA", 3500, To_Date('1-AUG-2012 11:47:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "LMN3", "US", "NJ", 2500, To_Date('1-SEP-2012 09:49:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "PQR2", "UK", "MC", 2600, To_Date('1-OCT-2012 04:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select 'ABC1', 'US', 'NY', 3200, To_Date('1-OCT-2012 06:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select "LMN3", "UK", "BT", 2400, To_Date('1-NOV-2012 07:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' From Dual

    )

    Select * from tbl_nm

    I need the output below.

    PQR2 UK MC 2600 1 OCTOBER 2012 04:45

    ABC1 US NY 3500 October 1, 2012 06:45

    LMN3 UK BT 2500 November 1, 2012 07:45

    The need the disc according to this system_id flagged as "A". But if the last disc of 'd' then it must show that the amount, but the file should be displayed in 'A '.

    I've tried a few and got stuck. Help, please. Not able to get a balance '.

    This question is a bit similar to needing help with a query result

    With Tbl_Nm as

    (

    Select 'ABC1' System_Id, region 'US', 'CHI' Sub_Region, 4000 balance, To_Date('1-JUN-2012 10:45:00 am', 'dd-mon-yyyy hh:mi:ss am') Last_Upd_Time, 'A' flag of double Union All

    Select 'PQR2', 'UK', 'LN', 2000, To_Date('1-JUL-2012 10:46:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select 'ABC1', 'IND","MAMA", 3500, To_Date('1-AUG-2012 11:47:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "LMN3", "US", "NJ", 2500, To_Date('1-SEP-2012 09:49:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "PQR2", "UK", "MC", 2600, To_Date('1-OCT-2012 04:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select 'ABC1', 'US', 'NY', 3200, To_Date('1-OCT-2012 06:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select "LMN3", "UK", "BT", 2400, To_Date('1-NOV-2012 07:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' From Dual

    )

    Select System_Id, region, Sub_Region, Balance, Last_Upd_Time of Tbl_Nm T1

    where t1. Last_Upd_Time = (select max (Last_Upd_Time) in the Tbl_Nm T2 where T1.) SYSTEM_ID = T2. SYSTEM_ID)

    So maybe you'd then

    ORDER BY DECODE(flag,'D',9,1) ASC...

    to get the Ds at the end of the list.

    or

    ORDER BY CASE WHAT flag = has ' (your other filters) AND then 9 or 1 end CSA,...

    HTH

  • I need help creating a vector mask with an adjustable edge or fade, can anyone help?

    I need help creating a vector with an adjustable edge mask or disappear so that I can surround a hand drawn - isolate the background so that I can black out around the hand, the hand a hair above, so I can not just pen tool, can anyone help?

    hand4.jpg

    hand.jpg

    I recommend starting with a layer mask based on the green channel, edition that with the curves to get a decent contrast and then paint in the areas needed.

  • need help for this query

    Hi gurus

    need help with this query,

    I want to display the records in the table emp
    SQL> Select Deptno,sal,sal/SUMSAL Percent,rn
      2  From  ( Select emp.*,Sum(Sal) Over() "SUMSAL",Row_number() Over(Order by sal Desc) rn
      3   From emp
      4        )
      5  /
    
          EMPNO     DEPTNO        SAL    PERCENT         RN
    --------- ---------- ---------- ---------- ----------
         7839         10       5000 .172265289          1
         7902         20       3000 .103359173          2
         7788         20       3000 .103359173          3
         7566         20       2975 .102497847          4
         7698         30       2850 .098191214          5
         7782         10       2450 .084409991          6
         7499         30       1600 .055124892          7
         7844         30       1500 .051679587          8
         7934         10       1300 .044788975          9
         7521         30       1250 .043066322         10
         7654         30       1250 .043066322         11
         7876         20       1100 .037898363         12
         7900         30        950 .032730405         13
         7369         20        800 .027562446         14
    
    14 rows selected.
                   
     
    I want just the records
          EMPNO     DEPTNO        SAL    PERCENT         RN
    ---------- ---------- ---------- ---------- ----------
          7839         10       5000 .172265289          1
          7902         20       3000 .103359173          2
          7788         20       3000 .103359173          3
          7566         20       2975 .102497847          4
          7698         30       2850 .098191214          5
    with sum (Percent) of remaing records.....
        Others                          .420327304  
    Thank you

    Published by: SeenuGuddu on February 27, 2011 03:39
    with a as
    (
    Select
    Empno, Deptno ,sal, sal/SUMSAL Percent,
    case when rn<=5 then rn else null end rnm
    From  (Select emp.*, Sum(Sal) Over() "SUMSAL",
    Row_number() Over(Order by sal Desc) rn
    From emp)
    )
    select
    case when max(rnm) is not null then to_char(max(empno)) else 'Others:' end empno,
    case when max(rnm) is not null then max(deptno) else null end deptno,
    case when max(rnm) is not null then max(sal) else null end sal,
    to_char(sum(percent), '90.99') percent,
    max(rnm) rn
    from a
    group by rnm order by rnm
    
    EMPNO                                    DEPTNO                 SAL                    PERCENT RN
    ---------------------------------------- ---------------------- ---------------------- ------- ----------------------
    7839                                     10                     5000                     0.17  1
    7902                                     20                     3000                     0.10  2
    7788                                     20                     3000                     0.10  3
    7566                                     20                     2975                     0.10  4
    7698                                     30                     2850                     0.10  5
    Others:                                                                                  0.42                         
    
    6 rows selected
    
  • Need help with a query

    Hi all

    I use the 10.2.5 oracle database 64-bit on windows 64-bit.

    I have the following tables

    CREATE TABLE LABS 
       (    "LAB_ID" NUMBER primary key, 
        "LAB_NAME" VARCHAR2(30 BYTE) ); 
    CREATE TABLE LAB_PC
       (    "LAB_PC_ID" NUMBER primary key, 
        "LAB_ID" NUMBER references labs(lab_id), 
        "PC_NAME" VARCHAR2(30 BYTE) );
    CREATE TABLE FREE_PC 
       (    "LOGIN" VARCHAR2(10 BYTE), 
        "LOG_DATE_TIME" DATE, 
        "LOG_USER" VARCHAR2(30 BYTE), 
        "LOG_LAB" VARCHAR2(30 BYTE), 
        "LOG_PC" VARCHAR2(30 BYTE), 
        "LOG_STATUS" CHAR(1 BYTE);
    

    LABORATORIES have all laboratories studying

    LAB_PC have all computers in a particular laboratory.

    FREE_PC contains the disconnection of a particular computer connection information in a particular LABORATORY. This table is populate text file using sql loader.

    I want to show to the student how computers are available for use in special LABORATORY so that the student could decide which LAB they should go.

    There is no relationship between FREE_PC and other tables. other paintings I create for the purpose of calculating or maybe I need this news.

    Some examples of data is less.

    Note:-LOG_STATUS = '1' means login and - LOG_STATUS = '0' means logout

    insert into LABS values(1,'N419');
    insert into LABS values (2,'N418');
    insert into lab_pc values (1,1,'PC1');
    insert into lab_pc values (2,1,'PC2');
    insert into lab_pc values (3,1,'PC3');
    insert into lab_pc values (4,1,'PC4');
    insert into lab_pc values (5,2,'PC1');
    insert into lab_pc values (6,2,'PC2');
    insert into lab_pc values (7,2,'PC3');
    insert into lab_pc values (8,2,'PC4');
    Insert into FREE_PC values('LogIN','06-SEP-15','11s1248','N419','PC1','1'); --PC1 login
    Insert into FREE_PC values('LogOUT','06-SEP-15','11s1248','N419','PC1','0'); --PC1 logoff
    Insert into FREE_PC values('LogIN','06-SEP-15','11s1248','N419','PC1','1');  --PC1 login again
    Insert into FREE_PC values('LogIN','06-SEP-15','11s1248','N419','PC2','1'); --PC2login
    Insert into FREE_PC values('LogOUT','06-SEP-15','11s1248','N419','PC2','0'); --PC2logoff
    Insert into FREE_PC values('LogIN','06-SEP-15','11s1248','N418','PC3','1'); --PC3 login
    Insert into FREE_PC values('LogIN','06-SEP-15','11s1248','N418','PC4','1'); --PC4 login
    Insert into FREE_PC values('LogOUT','06-SEP-15','11s1248','N418','PC4','0'); --PC4 logoff
    Insert into FREE_PC values('LogIN','06-SEP-15','11s1248','N418','PC4','1'); --PC4 login
    COMMIT;
    

    Now, I want to display the records like below

    How to create this query?

    Thank you.

    Kind regards.

    This is the query - the rest simulates just your tables - and I see nothing coded hard inside (except for log_status values)

    Select lab_name, max (max_log_date_time) on total_available_pc, total_login_pc, total_pc, max_log_date_time)

    from (select lab_name,

    Max (max_log_date_time) max_log_date_time,

    Count (*) total_pc,

    Count (case lv when end 1 '1') total_login_pc,.

    Count (case lv when '0' then 1 end) total_available_pc

    from (select lp.lab_pc_id,

    Max (l.lab_name) lab_name,

    Max (FP.log_date_time) max_log_date_time,

    LV NVL (Max (FP.log_status) Dungeon (dense_rank last order by fp.log_date_time), 0)

    of lab_pc lp

    inner join

    laboratories l

    on l.lab_id = lp.lab_id

    left outer join

    free_pc fp

    On lp.pc_name = fp.log_pc

    and l.lab_name = fp.log_lab

    Lp.lab_pc_id group

    )

    Lab_name group

    )

    Concerning

    Etbin

  • need help with the query, thx

    Hello
    I need a little help with the query I have to write;
    the table has 4 columns:
    col1               col2         col3       col4
    emp_name     empl_id    salary      year
    
    content of data:
    
    col1               col2         col3       col4
    smith             12           1200      1999
    smith             12           1340      2000
    smith             12           1500      2001
    jones             13           1550      1999 
    jones             13           1600      2000
    aron              14           1200      2002
    what I am asking is the following result: salary according to the latest available year
    i.e.
    smith         12         1500        2001
    jones         13         1600        2000
    aron          14         1200        2002
    ID appreciate some guidance on how to achieve
    Thank you
    Rgds
    select *from
    (select col1, col2,col3, col4,row_number() over(partition by col1 order by col4 desc)  rn  from 
    ) where rn=1
    
  • Need help creating a shell game

    I use Flash 8 that I haven't used since ' 06, so I don't know how to do much.

    I am trying to create a shell game. I have a chart of the shell I want to load to the scene. Because now I will load 3 of them, but I want it to be variable so I can add shells more if I want to.

    So I guess I have 3 questions:

    1. how to dynamically load the graph?

    2 is it better to use them as graphics or should they be a movieclip?

    3. how to move or mix the shells? I mean, what is the best way to move the shells because I need 2 shells move at the same time.

    Thanks for any help,

    Joe

    Place the image into a movieclip in the library and give it a link ID (right-click of the mc in the library and select link).  Then, you can use the attachMovie() function to dynamically load the shell of movieclip instances.

    For mve shells you can use the built-in Tween class, or a third party to the tweening class as TweenLite/TweenMax.  You can also use an onEnterFrame approach.  If you need help with these, try Google search using terms like "Tween AS2 tutorial" or «AS2 onEnterFrame tutorial»

  • Need help with the query (transpose)

    Hello experts, please help here - 11 g Oracle, attribute APA APB are fixed values and can be hard coded in query

    Need to transpose these data. Max(decode.. perd les données en sortie à cause de la condition de Max.)

    Entry:

    Name | Attribute | Value

    A1 APP 10

    A1 PDB 11

    A1 APA 20

    A1 PDB 21

    A2 BPA 13

    A2 BPB 14

    Expected results:

    Name AttVal1 AttVal2

    A1 10 11

    13 14 A2

    20 21 A1

    Hello

    Here's one way:

    WITH relevant_columns AS

    (

    SELECT name

    value

    CASE

    WHEN the attribute ("APA", "BPA") THEN 1

    WHEN the attribute ("PDB", "BPB") THEN 2

    END AS c_num

    ROW_NUMBER () (PARTITION BY NAME, attirbute

    Value of ORDER BY

    ) AS r_num

    FROM table_x

    )

    SELECT name, attval1, attval2

    OF relevant_columns

    PIVOT (MAX (value)

    FOR c_num IN (1 AS attval1

    2 UNDER attval2

    )

    )

    ORDER BY r_num, name

    ;

    If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.

    Why do you want to

    NAME ATTVAL1 ATTVAL2

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

    A1 10 11

    20 21 A1

    in the results, rather than

    NAME ATTVAL1 ATTVAL2

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

    10 21 A1

    20 11-A1

    ?  You would be satisfied to one or the other?

    Depending on your answer, you may need to modify the analytical ORDER BY clause in the ROW_NUMBER function.

  • Need help with a query of type "connect by level.

    Hello, I recently met 'connect by level' and I think he can solve my problem, but maybe not. I would like to create rows of data where the number of rows created varies according to the data from the original table.

    It works:

    with times like

    (select to_date (' 26/01/2014 01:00 ',' dd/mm/yyyy hh24:mi:ss') starttime,)

    TO_DATE (' 27/01/2014 00:00:00 ',' dd/mm/yyyy hh24:mi:ss') stoptime

    the double)

    Select starttime, stoptime, starttime + rownum / 24

    of the time

    connect by level < =.

    (Select trunc ((stoptime-starttime) * 24: 2) at the time)

    I would like to do something similar for several lines (following does not work)

    with times like

    (select to_date (' 26/01/2014 01:00 ',' dd/mm/yyyy hh24:mi:ss') starttime,)

    TO_DATE (' 27/01/2014 00:00:00 ',' dd/mm/yyyy hh24:mi:ss') stoptime

    of the double

    Union

    Select to_date (' 25/01/2014 18:00 ',' dd/mm/yyyy hh24:mi:ss') starttime.

    TO_DATE (' 27/01/2014 00:00:00 ',' dd/mm/yyyy hh24:mi:ss') stoptime

    the double)

    Select starttime, stoptime, starttime + rownum / 24

    of the time

    connect by level < =.

    (Select trunc ((stoptime-starttime) * 24: 2) at the time)

    I need to stay away from solutions of PL/SQL, this query will be wrapped in an application that can not handle the PL/SQL, going and coming from the database (I also suck in PL/SQL).

    Any help would be greatly appreciated, I have no knowledge here, I tried to read some of the documentation on hierarchical queries, but it is not yet clicking.

    Thank you!

    Or also:

    SQL > WITH times

    2 ALSO (SELECT TO_DATE (' 01:00 26/01/2014 ', "hh24:mi:ss dd/mm/yyyy") Starttime)

    3, TO_DATE (' 01/26/2014 03:00 ', 'hh24:mi:ss dd/mm/yyyy') Stoptime

    4 FROM TWO

    5 UNION

    6 SELECT TO_DATE (' 25/01/2014 18:00 ', "hh24:mi:ss mm/dd/yyyy") Starttime

    7, TO_DATE (' 25/01/2014 22:00 ', 'hh24:mi:ss dd/mm/yyyy') Stoptime

    8 DOUBLE)

    9. SELECT T.*, Starttime + Lvl / 24

    10. OF time T

    11, (SELECT LEVEL Lvl

    THE DOUBLE 12

    13 CONNECT BY LEVEL<>

    14 (SELECT MAX (TRUNC ((Stoptime-Starttime) * 24)))

    15 AT the time)):

    16. WHERE the lvl<= trunc="" (="" (stoptime="" -="" starttime)="" *="">

    17 ORDER 1, 3

    18.

    STARTTIME STOPTIME-STARTTIME + LVL/24

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

    January 25, 2014 18:00 January 25, 2014 22:00 January 25, 2014 19:00

    January 25, 2014 18:00 January 25, 2014 22:00 January 25, 2014 20:00

    January 25, 2014 18:00 January 25, 2014 22:00 January 25, 2014 21:00

    January 25, 2014 18:00 January 25, 2014 22:00 January 25, 2014 22:00

    26 January 2014 01:00 26 January 2014 03:00 January 26, 2014 02:00

    26 January 2014 01:00 26 January 2014 03:00 January 26, 2014 03:00

    6 selected lines.

  • Need help with a query complex for the production database

    Hello again,

    I need your help once again, for a query how to show me how long each stage of production is by order.
    See examples of data and what I expect.
    Thank you all for your help.

    We use Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Here the example data tables:
    CREATE      TABLE      TABLE_2
       
    (     "ORDER_NR"      VARCHAR2 (12)
    ,      "PRIORITY"      VARCHAR2 (2)
    ,      "WO_STEP"      VARCHAR2 (1)
    ,      "STEP_DATE"      DATE
    );
    
    CREATE      TABLE      TABLE_1
    (     "ORDER_NR"           VARCHAR2     (12) PRIMARY KEY
    ,      "PRIORITY"           VARCHAR2      (2)
    ,      "CREATE_DATE"      DATE
    ,     "ACT_STEP"          VARCHAR2     (2)
    ,     "STEP_DATE"          DATE
    ,     "EMPLOYEE"          VARCHAR2     (5)
    ,     "DESCRIPTION"     VARCHAR2     (20)
    );
    
    INSERT      INTO      TABLE_1      (ORDER_NR,               PRIORITY,      CREATE_DATE,                                                        ACT_STEP,     STEP_DATE,                                                            EMPLOYEE,     DESCRIPTION) 
                        VALUES           ('1KKA1T205634',     '12',          TO_DATE('10-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'),     'U',          TO_DATE('28-FEB-13 12:00:00','DD-MON-RR HH24:MI:SS'),     'W0010',     'CLEAN HOUSE');
    INSERT      INTO      TABLE_1      (ORDER_NR,               PRIORITY,     CREATE_DATE,                                                        ACT_STEP,     STEP_DATE,                                                            EMPLOYEE,     DESCRIPTION)
                        VALUES           ('1KKA1Z300612',     '12',          TO_DATE('08-FEB-13 14:00:00','DD-MON-RR HH24:MI:SS'),     'F',          TO_DATE('20-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'),     'K0052',     'REPAIR CAR');
    
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'A',          TO_DATE('12-FEB-13 13:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          '5',          TO_DATE('13-FEB-13 09:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'K',          TO_DATE('13-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          '5',          TO_DATE('13-FEB-13 11:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'K',          TO_DATE('13-FEB-13 12:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          '5',          TO_DATE('13-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'C',          TO_DATE('14-FEB-13 08:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'B',          TO_DATE('14-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'E',          TO_DATE('18-FEB-13 13:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'F',          TO_DATE('20-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'S',          TO_DATE('21-FEB-13 08:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'R',          TO_DATE('21-FEB-13 09:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'U',          TO_DATE('28-FEB-13 12:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'A',          TO_DATE('12-FEB-13 13:52:42','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          '5',          TO_DATE('13-FEB-13 09:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'K',          TO_DATE('13-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          '5',          TO_DATE('13-FEB-13 11:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'K',          TO_DATE('13-FEB-13 12:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          '5',          TO_DATE('13-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'C',          TO_DATE('14-FEB-13 08:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'B',          TO_DATE('14-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'E',          TO_DATE('18-FEB-13 13:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'F',          TO_DATE('20-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'));
    COMMIT;
    And here's what I expect of my request:
    SYSDATE     28.Feb.13 14:00                                                                                     
                                                                                              
    ORDER_NR     PRIORITYCREATE_DATE     STATUS     STATUS_DATE     DESCRIPTION     AGE_1     AGE_2     WAITNG     STEP_A     STEP_B     STEP_C     STEP_5     STEP_K     STEP_E     STEP_F     STEP_S     STEP_R     
    1KKA1T205634     12     10.Feb.13 10:00     U     28.Feb.13 12:00     CLEAN HOUSE     18,083     8,833     2,125     0,833     4,125     0,083     0,750     0,208     2,125     0,666     0,042     7,125     
    1KKA1Z300612     12     08.Feb.13 14:00     F     20.Feb.13 16:00     REPAIR CAR     20,000     16,042     2,125     0,833     4,125     0,083     0,750     0,208     2,125     0,666          
    And now the explanation for the result of the query:
    The AGE_1 is the difference in days between the "CREATE_DATE" and if EXSIST L'ETAPE 'U' then STEP_DATE or if the STEP 'U' is not found in TABLE_2 then it should show the difference in days between the "CREATE_DATE' and the 'SYSDATE.
    The AGE_2 is the difference in days between the STEP "A" STEP_DATE and IF EXSIST L'ETAPE 'R' then STEP_DATE or if the STEP 'R' is not in TABLE_2 then it should show the difference in days between the "CREATE_DATE' and the 'SYSDATE.
    The EXPECTATION is the difference in days between CREATE_DATE and STEP 'A' STEP_DATE
    The following columns indicate the days, how long the ORDER_NR remains in these TIMES, if an ORDER_NR comes in the same STEP should be calculated together more than once.
    If the ORDER_NR jump a step, it should show a zero in the specific field.

    I hope that my explanation is good enough, my English skills are far from good.

    Thank you for all your help.

    Hosts Reinhard W.

    Solomon Yakobson says:
    Just add the amounts:

    In fact, you could edit all CASES:

    with t2 as (
                select  t.*,
                        lead(step_date) over(partition by order_nr order by step_date) next_step_date
                  from  table_2 t
               )
    select  t1.*,
            nvl(
                max(
                    case t2.wo_step
                      when 'U' then t2.step_date
                    end
                   ),
               sysdate
              ) - t1.create_date age_1,
            nvl(
                max(
                    case t2.wo_step
                      when 'R' then t2.step_date
                    end
                   ),
               sysdate
              ) - t1.create_date age_2,
            sum(
                case
                  when t2.wo_step in ('B','5') then t2.next_step_date - t2.step_date
                end
               ) step_b_5,
            sum(
                case t2.wo_step
                  when 'C' then t2.next_step_date - t2.step_date
                end
               ) step_c,
            sum(
                case t2.wo_step
                  when 'K' then t2.next_step_date - t2.step_date
                end
               ) step_k,
            sum(
                case t2.wo_step
                  when 'E' then t2.next_step_date - t2.step_date
                end
               ) step_e,
            sum(
                case t2.wo_step
                  when 'F' then t2.next_step_date - t2.step_date
                end
               ) step_f,
            sum(
                case t2.wo_step
                  when 'S' then t2.next_step_date - t2.step_date
                end
               ) step_s,
            sum(
                case t2.wo_step
                  when 'R' then t2.next_step_date - t2.step_date
                end
               ) step_r
      from  table_1 t1,
            t2
      where t2.order_nr = t1.order_nr
      group by t1.order_nr,
               t1.priority,
               t1.create_date,
               t1.act_step,
               t1.step_date,
               t1.employee,
               t1.description
    /
    
    ORDER_NR     PR CREATE_DA AC STEP_DATE EMPLO DESCRIPTION      AGE_1      AGE_2   STEP_B_5     STEP_C  STEP_K     STEP_E     STEP_F        STEP_S     STEP_R
    ------------ -- --------- -- --------- ----- ----------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
    1KKA1T205634 12 10-FEB-13 U  28-FEB-13 W0010 CLEAN HOUSE 18.0833333 10.9583333      4.875 .083333333 .208333333      2.125 .666666667 .041666667      7.125
    1KKA1Z300612 12 08-FEB-13 F  20-FEB-13 K0052 REPAIR CAR   44.252338  44.252338      4.875 .083333333 .208333333      2.125
    
    SQL>
    

    SY.

  • NEED HELP WITH THE QUERY, NEED MORE RECENT FILE ONLY

    Hi all

    That is,

    I have an assignment I need to find agents that allow players to break the rules.

    So far, I have 41 results, in which there are 4 principles and 24 footballers and football player even beat more than one rule or the rule more than once.

    What I need now is to make arrangements so that every footballer appears once n matter how many times they have broken the rules.


    I have

    SELECT
    t.transfer_time | ' ' || a.first_name | ' ' || a.last_name | ' ' || f.first_name | ' ' || f.last_name | ' ' || f.footballer_id | ' ' || t.transfer_id
    Of
    agents a, t transfers, footballers f, footballers_fees fo
    WHERE
    a.agent_id = t.broker_id
    AND
    t.footballer_id = f.footballer_id
    AND
    f.footballer_id = fo.footballer_id
    AND
    (RULE 1 BROKEN AND RULE 2 BROKEN
    OR
    RULE 1 BROKEN AND ARTICLE 2 DOES NOT DECOMPOSE
    OR
    RULE 1 DOES NOT DECOMPOSE AND RULE 2 BROKEN)


    GROUP BY
    t.transfer_time | ' ' || a.first_name | ' ' || a.last_name | ' ' || f.first_name | ' ' || f.last_name | ' ' || f.footballer_id | ' ' || t.transfer_id
    ORDER BY
    t.transfer_time | ' ' || a.first_name | ' ' || a.last_name | ' ' || f.first_name | ' ' || f.last_name | ' ' || f.footballer_id | ' ' || t.transfer_id
    ;



    (I did not type the SQL code to rules 1 and 2 but I know it works)

    Now, I need not to show that every footballer once they broke rule and more than once or not.

    I was looking at the screen nearly enough hours 10 and any help or ideas would be greatly appreciated

    Thank you all :)

    Hello

    Welcome to the forum!

    Whenever you have a problem, please post a small example of data (CREATE TABLE and INSERT statements) so that people who want to help you can recreate the problem and test their ideas. You don't have to display a large amount of data. In this case, it seems that 2 to 10 lines for each table could give a good picture of the problem.
    After the results that you want samples fropm, and explain how you get those resulting from these data.
    Always tell what version of Oracle you are using.

    The ideal outcome would be just what you '; Re I get now, but with some deleted rows and only 1 line by left footballer? If so, do a subquery on the original query, and then add somehting like

    , ROW_NUMBER () OVER (PARTITION BY f.footballer_id ORDER BY NULL)  AS r_num
    

    in the SELECT clause.
    then, in the main query, display only lines

    WHERE   r_num  = 1
    

    ROW_NUMBER requires an ORDER byclause of analytics. If you ORDER BY a constant (e.g. NULL) then what line gets number 1 will be arbitrary. If you care who lines for a given player is numbered 1 (and therefore included in the final output), then adjust the analytical ORDER BY clause. (You the title mentions "most recent record only", so if the dt column indicates whether a line is "newer" than another, you can "ORDER BY dt DESC".)

    I know this response is vague in places. Without a concrete example (CREATE TABLE and instructions INSERT for examples of data and outcomes from these data), that's the best I can do.

  • Need help with SQL Query - change of name history of audit table.

    I need your help to find the result in the following way...


    Emp No    New_name    Old_Name
    -----------------------------------------------
    1           Name3        Name2
    1           Name2        Name1
    create table emp(emp_id number(10),
    emp_name varchar(50),
    constraints emp_pk primary key(emp_id) );
    
    
    
    create table emp_audit(
    audit_id number(10),
    emp_id number(10),
    emp_name varchar(50),
    audit_date date,
    constraints emp_audit_pk primary key (audit_id),
    constraints  emp_audit_emp_fk foreign key(emp_id)  references emp(emp_id));
    
    insert into emp values(1,'Name3');
    
    
    insert into EMP_AUDIT (audit_id, emp_id, emp_name, audit_date)
    values (1, 1, 'Name1', to_date('14-08-2011', 'dd-mm-yyyy'));
    insert into EMP_AUDIT (audit_id, emp_id, emp_name, audit_date)
    values (2, 1, 'Name2', to_date('15-08-2011', 'dd-mm-yyyy'));
    commit;
    Thank you...

    Dipabkar Bédard (DB) wrote:

    We write is the query without using "partition by" in oracle...?

    with t as (
               select  audit_id,
                       emp_id,
                       emp_name,
                       row_number() over(order by audit_id) rn
                 from  emp_audit
                 order by emp_id,
                          audit_id
              )
    select  a.audit_id,
            a.emp_id,
            a.emp_name old_name,
            nvl(b.emp_name,(select c.emp_name from emp c where c.emp_id = a.emp_id)) new_name
      from  t a left join t b
            on (
                    b.emp_id = a.emp_id
                and
                    b.rn = a.rn + 1
               )
    /
    
      AUDIT_ID     EMP_ID OLD_NAME                                           NEW_NAME
    ---------- ---------- -------------------------------------------------- ------------
             1          1 Name1                                              Name2
             2          1 Name2                                              Name3
    
    SQL> 
    

    And without analytical functions:

    with t1 as (
                select  audit_id,
                        emp_id,
                        emp_name
                  from  emp_audit
                  order by emp_id,
                           audit_id
               ),
         t2 as (
                select  audit_id,
                        emp_id,
                        emp_name,
                        rownum rn
                  from  t1
               )
    select  a.audit_id,
            a.emp_id,
            a.emp_name old_name,
            nvl(b.emp_name,(select c.emp_name from emp c where c.emp_id = a.emp_id)) new_name
      from  t2 a left join t2 b
            on (
                    b.emp_id = a.emp_id
                and
                    b.rn = a.rn + 1
               )
    /
    
      AUDIT_ID     EMP_ID OLD_NAME                                           NEW_NAME
    ---------- ---------- -------------------------------------------------- ----------
             1          1 Name1                                              Name2
             2          1 Name2                                              Name3
    
    SQL> 
    

    SY.

  • Help create the query

    Hi all

    I have the below requirement.
    Master table:
    Product ID      Product Name
    1               TV
    2               Cellphone
    3               Laptop
    4               DVD Player
    
    Details table:
    Product ID     Spec type     Spec Detail
    1               Color          Blue
    1               Weight          20
    2               Color          Blue
    2               Weight          20
    3               Color          Blue
    3                Weight          25
    4               Color          Blue
    4               Weight          20
    4               Height          10
    I'm looking for a way to identify products with the exact same specifications.

    That is to say, in the example TV and cell phone above has exact specifications.
    So the result of the query must be TV and phone cell phone here.

    Is it possible to do in a query, or we need a sql block to perform this action.

    Any help would be greatly appreciated.

    Thank you
    Agathya

    Hi agathya,

    We do not know how you want to handle the situation where more than two products have the same specifications, so I extended your sample data slightly to take account of this situation as well:

    SQL> create table products (id,name)
      2  as
      3  select 1, 'TV' from dual union all
      4  select 2, 'Cellphone' from dual union all
      5  select 3, 'Laptop' from dual union all
      6  select 4, 'DVD Player' from dual union all
      7  select 5, 'Radio' from dual union all
      8  select 6, 'VCR' from dual
      9  /
    
    Tabel is aangemaakt.
    
    SQL> create table product_specifications (product_id,spec_type,spec_detail)
      2  as
      3  select 1, 'Color' , 'Blue' from dual union all
      4  select 1, 'Weight', '20'   from dual union all
      5  select 2, 'Color' , 'Blue' from dual union all
      6  select 2, 'Weight', '20'   from dual union all
      7  select 3, 'Color' , 'Blue' from dual union all
      8  select 3, 'Weight', '25'   from dual union all
      9  select 4, 'Color' , 'Blue' from dual union all
     10  select 4, 'Weight', '20'   from dual union all
     11  select 4, 'Height', '10'   from dual union all
     12  select 5, 'Color' , 'Blue' from dual union all
     13  select 5, 'Weight', '20'   from dual union all
     14  select 6, 'Color' , 'Blue' from dual union all
     15  select 6, 'Weight', '20'   from dual union all
     16  select 6, 'Height', '10'   from dual
     17  /
    
    Tabel is aangemaakt.
    
    SQL> select p1.name
      2       , p2.name
      3    from products p1
      4       , products p2
      5       , product_specifications ps1
      6       , product_specifications ps2
      7   where p1.id = ps1.product_id
      8     and p2.id = ps2.product_id
      9     and p1.id < p2.id
     10   group by p1.id
     11       , p1.name
     12       , p2.id
     13       , p2.name
     14  having sqrt(count(*)) =
     15         count(case when ps1.spec_type = ps2.spec_type and ps1.spec_detail = ps2.spec_detail then 1 end)
     16  /
    
    NAME       NAME
    ---------- ----------
    TV         Cellphone
    TV         Radio
    Cellphone  Radio
    DVD Player VCR
    
    4 rijen zijn geselecteerd.
    

    But why devil you or your specifications product model predecessor like that? You are much more complicated that it should be. And the data type of size and weight should be not the same as those of color. But now they are. And how do limit you the allowed values for the colors? Color, weight and size are characteristic of your products so that they should have been modeled like this.

    See how easily your questions becomes after remodeling it:

    SQL> drop table product_specifications purge
      2  /
    
    Tabel is verwijderd.
    
    SQL> drop table products purge
      2  /
    
    Tabel is verwijderd.
    
    SQL> create table products (id,name,color,weight,height)
      2  as
      3  select 1, 'TV', 'Blue', 20, null from dual union all
      4  select 2, 'Cellphone', 'Blue', 20, null from dual union all
      5  select 3, 'Laptop', 'Blue', 25, null from dual union all
      6  select 4, 'DVD Player', 'Blue', 20, 10 from dual union all
      7  select 5, 'Radio', 'Blue', 20, null from dual union all
      8  select 6, 'VCR', 'Blue', 20, 10 from dual
      9  /
    
    Tabel is aangemaakt.
    
    SQL> select * from products
      2  /
    
            ID NAME       COLO     WEIGHT     HEIGHT
    ---------- ---------- ---- ---------- ----------
             1 TV         Blue         20
             2 Cellphone  Blue         20
             3 Laptop     Blue         25
             4 DVD Player Blue         20         10
             5 Radio      Blue         20
             6 VCR        Blue         20         10
    
    6 rijen zijn geselecteerd.
    
    SQL> select p1.name
      2       , p2.name
      3    from products p1
      4       , products p2
      5   where p1.id < p2.id
      6     and ( p1.color = p2.color or (p1.color is null and p2.color is null))
      7     and ( p1.weight = p2.weight or (p1.weight is null and p2.weight is null))
      8     and ( p1.height = p2.height or (p1.height is null and p2.height is null))
      9  /
    
    NAME       NAME
    ---------- ----------
    TV         Cellphone
    TV         Radio
    Cellphone  Radio
    DVD Player VCR
    
    4 rijen zijn geselecteerd.
    

    I hope this helps.

    Kind regards
    Rob.

  • Need help creating automatic setup of WiFi for XP Win 7, etc... Get errors on XP

    I have 100s of Win 7 and Win XP computers and I need a way to automatically configure WiFi. Some will be made for students and others for personnel etc. I did hours of research on this mega and using a Win 7 PC to create export to a USB key that is susposed to work on all versions of XP upwards. But, of course, it isn't. This works for Windows 7 and Vista, but not for XP.

    Here's what I did...

    1 a tried using the XP "Wireless Network Setup Wizard" to my XP PC. But it is defective and not allow you to create an installation WITHOUT any encryption, of course it is not acceptable as our WiFi does not use it. We use a system of Access Point Aruba which forces authentication VIA AD/connection on the first attempt to navigate the web. No encryption AT ALL as much as the WiFi client installation is concerned. I also did a profile exactly as I want only it except that I put in bogus WEP settings so it creates the SMRTNTKY with the WSETTING file. WFC file in it and then edited the. WFC to remove file but then it wouldn't work which is NOT ACCEPTABLE.

    2 went to a Win 7 PC as it does from there is supposed to work on Vista and XP too and had no problem using the option 'Copy this network on a USB flash drive profile' and it works perfectly for Win 7 and Vista, but - error on XP with the following message...

    The wizard found no information needed to set up a network, or the information was not usable. Try to rerun the wizard to your original computer.

    After reviewing the files generated between the XP method to export a WiFi profile to a USB key and how to Win 7 well, I found the following differences, all related to security settings. Of course, it's a bug or a design defect and a BIG problem for the IT Pro.

    Here's what my two WSETTING. Resemble WFC files.

    For XP I have:



       
            011C0F3E-EB0F-46B8-BA95-267ADEA25EC3
            0B4E59B8-8317-46B2-B8C2-C46850162E6C
            The Microsoft Wireless Network Configuration Wizard
       

        Student
        ESS
        0
        0
       
            Open
            WEP
            12345
            0
            0
       

    For Win 7 I have:



       
            01BC3658-4F27-42D1-92F7-3F7CF581A75E
            0B4E59B8-8317-46B2-B8C2-C46850162E6C
            The Microsoft Wireless Network Configuration Wizard
       

        Student
        ESS
        0
        0
       
            Open
            None
           
            0
            0
       

    There seems to be ONLY two lines which differ between the two files and are as follows...

    For XP:

    WEP
            12345

    For Win 7:

    None
           

    As you can see that the difference is in the security settings that I don't use. (This is a choice made by the powers above me and I have to work with that. MS should keep in mind at ANY moment the IT pro should have the last say on optional parameters is NOT MS)

    It seems that Microsoft, when they created this tool never intended be used by computer professionals as they force the settings for the IT Pro to decide at ANY TIME, not Ms.  IE to use WEP/WPA etc, or NONE.

    So am I missing something? How do I create an automated way I can run thousands of times without error on XP, Vista or Win 7 to configure profiles WiFi which will have NO apparent safety, but who actually do?

    I would VIA reg setting if I knew where to find all the reg settings to do, but the hours of Googleing gave this info. Everything seems to point to the network VIA USB method profile, which would be perfect if it worked on XP. If there was a simple file I could copy from a master system of its many clones then it works. I could wrap it in one. BAT file or use INNO Script to create a file of configuration etc. Many ways I could do if I could find any files, settings, etc., I would need control.

    It shouldn't be rocket science. I've seen where Microsoft has said they recognize the need for professionals like me to be able to automate this process for any tech user, but then the tools thay do aren't for the professionals that they take away the option of PROFESSIONAL (on-site tech who knows the most, is NOT MS) to decide, using their knowledge intament businesses must make choices about the use or non-use of WEP etc (it's a theme common in MS assistants, just look at the hack job SYSPrep is based by default on the local Administrator profile profile, a MAJOR mistake and a security risk, rendering it useless in a corporate environment where the local Admin profile is preconfigured with options parameters, links, etc. to the things a pro IT does not that the general user to see or to do but they need on the local admin ONLY)

    Thanks for any help you can give.

    Ralph Malph

    Hello

    Questions like these are much better handled in the TechNet IT Pro Forums.

    My moderator tools cannot transfer messages on Windows forums, please re - ask you question there.

    http://social.technet.Microsoft.com/forums/en-us/w7itpronetworking/threads?sort=firstpostdesc

  • Need help on a query

    I have the following query:

    Select nvl (iv.bed_num, fv.bed_num) as bed_num,

    NVL (IV. Season, 2014) season.

    NVL (IV.months, FV.months) months.

    days_irrigated,

    hours_irrigated,

    times_fertilized,

    amount_of_fert

    from (select bed_num,

    season,

    TO_NUMBER (to_char(irrigation_date,'MM')) months,

    Count (*) as days_irrigated,

    Sum (Duration) as hours_irrigated

    of irrigation_view

    Bed_num group,

    season,

    TO_NUMBER (to_char (irrigation_date, 'MM'))) iv

    full join

    (select bed_num,

    season,

    TO_NUMBER (to_char(effort_date,'MM')) months,

    Count (*) as times_fertilized,

    flat as amount_of_fert

    of fert_view

    Bed_num group,

    season,

    TO_NUMBER (to_char (effort_date, 'MM'))) fv

    On iv.bed_num = fv.bed_num

    and iv.season = fv.season

    and iv.months = fv.months;

    The results are exactly what I need.

    ex.

    BED_NUM SEASON MONTHS DAYS_IRRIGATED HOURS_IRRIGATED TIMES_FERTILIZED AMOUNT_OF_FERT

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

    10       2014          6                                               1            8.6

    21       2014          5                                               1           22.8

    24       2014          6                                               1           15.7

    14       2014          5                                               1           2.85

    8       2015          5              2               8

    25       2015          5              2               8

    26       2015          5              2               8

    When I try the query results (using above query in a with clause) I get two results.  If I put the condition 'season where = 2015' I retrieve all rows in 2015.  "When I put the condition" where season = 2014 "no records are returned.  When I leave off the where clause, all records are returned. 


    I also need to say all 2014 records are in the table fert_view and 2015 records from the irrigation_view.

    Thanks for the help of Frank.  I solved it.  It seems that in my case for some reason any NVL() does not work as expected.  I changed the NVL () COALESCE and it started working.  If anyone knows why this is, please share your knowledge.

Maybe you are looking for