Accumulated SUM in SQL

I was trying to generate the report from table SALGRADE in SQL script only. The report layout look like one based column and one accumulated sum column:
Sales Accumulted Sum
700 700
1201 1901
1201 3102
1401 4503
1401 5904
2001 7905
3001 10906
The data source are from SALGRADE table in SCOTT/TIGER
GRADE LOSAL
1 700
2 1201
3 1401
4 2001
5 3001
6 1401
7 1201
7 rows selected.
But the following script is generated with wrong result in row 3 and 5:
SQL> select b.grade,sum(c.losal) from salgrade b,salgrade c
2 where b.grade >= c.grade
3 group by b.grade
4 /
GRADE SUM(C.LOSAL)
1 700
2 1901
3 3302
4 5303
5 8304
6 9705
7 10906
7 rows selected.
Is there a way to re-write the SQL to get correct result?
Thanks
David Wu
null

david,
there seems to be a difference between the report you want to produce and the select you created.
the report sorts the data by column LOSAL, while your select sorts(groups) them by GRADE. if you re-write your select to use LOSAL as join and group column, the result should look like your example.
regards,
the oracle reports team

Similar Messages

  • Question about SUM in SQL query

    I have a SQL ststement which is listed below along with it's output.
    For the NUM_REQ column, I am expecting to get the number 832 because the pm_requirements_table contains 16 records and they all have a frequency of WEEKLY.
    16 * 52 = 832. The query returns 12480 which I can see that it is multiplying the 832 by 15 which is the number of entries in the lpm table 16 * 52 * 15 = 12480.
    I need the lpm table in there for other reasons, so my question is how can I get it to return 832 and still have the lpm table as part of the query.
    Thanks,
    George
    SQL
    SELECT 'NAS WIDE' as target
    , 1 as years
    , count(distinct lpm.fac_ident) as facilities
    , SUM(CASE  upper(req.frequency)
      WHEN 'DAILY' THEN 365
      WHEN 'WEEKLY' THEN 52
      WHEN 'MONTHLY' THEN 12
      WHEN 'QUARTERLY' THEN 4
      WHEN 'SEMIANNUALLY' THEN 2
      WHEN 'ANNUALLY' THEN 1
      ELSE 0
    END) as num_req
    FROM lpm, pm_requirements_table req
    group by 'NAS WIDE';OUTPUT
    "TARGET","YEARS","FACILITIES","NUM_REQ"
    "NAS WIDE",1,1,12480
    -- PM_REQUIREMENTS_TABLE
    "PUBLICATION_ORDER","PUBLICATION_PARAGRAPH_NUMBER","DESCRIPTION","FREQUENCY","CHECK_OR_MAINTENANCE","PRTANTAC_ID"
    "6310.19A","161A","Check transmitter average rf power output","WEEKLY","",2
    "6310.19A","161B","Check transmitter VSWR","WEEKLY","",3
    "6310.19A","161C","Check RMS transmitter pulse width","WEEKLY","",4
    "6310.19A","161D(1)","Check filament current","WEEKLY","",5
    "6310.19A","161D(2)","Check focus coil current","WEEKLY","",6
    "6310.19A","161D(3)","Check Klystron voltage","WEEKLY","",7
    "6310.19A","161D(4)","Check Klystron current","WEEKLY","",8
    "6310.19A","161D(5)","Check PFN voltage","WEEKLY","",9
    "6310.19A","161D(6)","Check vacuum pump current","WEEKLY","",10
    "6310.19A","161E","Check target receiver MDS","WEEKLY","",11
    "6310.19A","161F","Check target receiver NF","WEEKLY","",12
    "6310.19A","161G","Check target receiver recovery","WEEKLY","",13
    "6310.19A","161H","Check weather receiver MDS","WEEKLY","",14
    "6310.19A","161I","Check weather receiver NF","WEEKLY","",15
    "6310.19A","161J","Check weather receiver recovery","WEEKLY","",16
    "6310.19A","161K","Check spare modem operation","WEEKLY","",17
    -- LPM table
    "LOG_ID","FAC_IDENT","FAC_TYPE","CODE_CATEGORY","SUPPLEMENTAL_CODE","MAINT_ACTION_CODE","INTERRUPT_CONDITION","ATOW_CODE","SECTOR_CODE","LOG_STATUS","START_DATE","START_DATETIME","END_DATE","END_DATETIME","MODIFIED_DATETIME","WR_AREA","SHORT_NAME","EQUIPMENT_IDENT","INTERVAL_CODE","EARLIEST_DATE","EARLIEST_DATETIME","SCHEDULED_DATE","SCHEDULED_DATETIME","LATEST_DATE","LATEST_DATETIME","WR_CREW_UNIT","WR_WATCH","PUBLICATION_ORDER","PUBLICATION_ORDER_ORIGINAL","PUBLICATION_PARAGRAPH","PUBLICATION_PARAGRAPH_ORIGINAL","NUMBER_OF_TASKS","LOG_SUMMARY","COMMENTS","RELATED_LOGS","LPMANTAC_ID"
    108305902,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",07-MAY-10,"05/07/2010 3:24",07-MAY-10,"05/07/2010 3:28","05/07/2010 3:31","RADAR","SYS","SYSTEM","W","05/02/2010","05/02/2010 0:00",05-MAY-10,"05/05/2010 0:00",08-MAY-10,"05/08/2010 0:00","RADR","","6310.19A","6310.19A","161.K","161. K","1","","","",1
    108306002,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",02-MAY-10,"05/02/2010 21:00",02-MAY-10,"05/02/2010 21:30","05/03/2010 1:07","RADAR","SYS","CHAN B","W","05/02/2010","05/02/2010 0:00",05-MAY-10,"05/05/2010 0:00",08-MAY-10,"05/08/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",2
    108306102,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",02-MAY-10,"05/02/2010 21:00",02-MAY-10,"05/02/2010 21:30","05/03/2010 1:07","RADAR","SYS","CHAN A","W","05/02/2010","05/02/2010 0:00",05-MAY-10,"05/05/2010 0:00",08-MAY-10,"05/08/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",3
    104188702,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",29-APR-10,"4/29/2010 10:09",29-APR-10,"4/29/2010 10:11","4/29/2010 10:30","RADAR","SYS","SYSTEM","W","4/25/2010","4/25/2010 0:00",28-APR-10,"4/28/2010 0:00",01-MAY-10,"05/01/2010 0:00","RADR","","6310.19A","6310.19A","161.K","161. K","1","","","",4
    104188402,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",26-APR-10,"4/26/2010 13:33",26-APR-10,"4/26/2010 13:46","4/26/2010 15:23","RADAR","SYS","CHAN A","W","4/25/2010","4/25/2010 0:00",28-APR-10,"4/28/2010 0:00",01-MAY-10,"05/01/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",5
    104188502,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",26-APR-10,"4/26/2010 13:33",26-APR-10,"4/26/2010 13:46","4/26/2010 15:23","RADAR","SYS","CHAN B","W","4/25/2010","4/25/2010 0:00",28-APR-10,"4/28/2010 0:00",01-MAY-10,"05/01/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",6
    101223702,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",19-APR-10,"4/19/2010 1:30",19-APR-10,"4/19/2010 2:10","4/19/2010 3:12","RADAR","SYS","CHAN B","W","4/18/2010","4/18/2010 0:00",21-APR-10,"4/21/2010 0:00",24-APR-10,"4/24/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",7
    101223802,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",19-APR-10,"4/19/2010 1:30",19-APR-10,"4/19/2010 2:10","4/19/2010 3:12","RADAR","SYS","CHAN A","W","4/18/2010","4/18/2010 0:00",21-APR-10,"4/21/2010 0:00",24-APR-10,"4/24/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",8
    101223602,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",19-APR-10,"4/19/2010 1:00",19-APR-10,"4/19/2010 1:09","4/19/2010 3:12","RADAR","SYS","SYSTEM","W","4/18/2010","4/18/2010 0:00",21-APR-10,"4/21/2010 0:00",24-APR-10,"4/24/2010 0:00","RADR","","6310.19A","6310.19A","161.K","161. K","1","","","",9
    96642602,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",12-APR-10,"04/12/2010 10:25",12-APR-10,"04/12/2010 10:34","04/12/2010 17:49","RADAR","SYS","SYSTEM","W","04/11/2010","04/11/2010 0:00",14-APR-10,"4/14/2010 0:00",17-APR-10,"4/17/2010 0:00","RADR","","6310.19A","6310.19A","161.K","161. K","1","","","",10
    96642402,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",11-APR-10,"04/11/2010 11:10",11-APR-10,"04/11/2010 11:15","04/11/2010 12:51","RADAR","SYS","CHAN B","W","04/11/2010","04/11/2010 0:00",14-APR-10,"4/14/2010 0:00",17-APR-10,"4/17/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",11
    96642302,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",11-APR-10,"04/11/2010 11:05",11-APR-10,"04/11/2010 11:10","04/11/2010 12:51","RADAR","SYS","CHAN A","W","04/11/2010","04/11/2010 0:00",14-APR-10,"4/14/2010 0:00",17-APR-10,"4/17/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",12
    92805502,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",07-APR-10,"04/07/2010 18:10",07-APR-10,"04/07/2010 18:22","04/07/2010 19:04","RADAR","SYS","CHAN A","W","04/04/2010","04/04/2010 0:00",07-APR-10,"04/07/2010 0:00",10-APR-10,"04/10/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",13
    92805402,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",07-APR-10,"04/07/2010 17:53",07-APR-10,"04/07/2010 18:05","04/07/2010 19:04","RADAR","SYS","CHAN B","W","04/04/2010","04/04/2010 0:00",07-APR-10,"04/07/2010 0:00",10-APR-10,"04/10/2010 0:00","RADR","","6310.19A","6310.19A","161A-J","161 A-J","15","","","",14
    92805302,"ATL","ASR",50,"0","P","","WEQ1C","SO1LB","C",07-APR-10,"04/07/2010 9:55",07-APR-10,"04/07/2010 10:05","04/07/2010 10:29","RADAR","SYS","SYSTEM","W","04/04/2010","04/04/2010 0:00",07-APR-10,"04/07/2010 0:00",10-APR-10,"04/10/2010 0:00","RADR","","6310.19A","6310.19A","161.K","161. K","1","","","",15Edited by: George Heller on Jul 15, 2011 10:32 AM

    -- LPM
    CREATE TABLE "LPM"
        "LOG_ID"              NUMBER(22,0) NOT NULL ENABLE,
        "FAC_IDENT"           VARCHAR2(5),
        "FAC_TYPE"            VARCHAR2(5),
        "CODE_CATEGORY"       NUMBER(22,0) NOT NULL ENABLE,
        "SUPPLEMENTAL_CODE"   VARCHAR2(1),
        "MAINT_ACTION_CODE"   VARCHAR2(1),
        "INTERRUPT_CONDITION" VARCHAR2(22),
        "ATOW_CODE"           VARCHAR2(22),
        "SECTOR_CODE"         VARCHAR2(5),
        "LOG_STATUS"          VARCHAR2(3) NOT NULL ENABLE,
        "START_DATE" DATE,
        "START_DATETIME" VARCHAR2(22),
        "END_DATE" DATE,
        "END_DATETIME"      VARCHAR2(22),
        "MODIFIED_DATETIME" VARCHAR2(22),
        "WR_AREA"           VARCHAR2(6),
        "SHORT_NAME"        VARCHAR2(15),
        "EQUIPMENT_IDENT"   VARCHAR2(15),
        "INTERVAL_CODE"     VARCHAR2(255),
        "EARLIEST_DATE"     VARCHAR2(4000),
        "EARLIEST_DATETIME" VARCHAR2(255),
        "SCHEDULED_DATE" DATE,
        "SCHEDULED_DATETIME" VARCHAR2(22),
        "LATEST_DATE" DATE,
        "LATEST_DATETIME"                VARCHAR2(22),
        "WR_CREW_UNIT"                   VARCHAR2(10),
        "WR_WATCH"                       VARCHAR2(1),
        "PUBLICATION_ORDER"              VARCHAR2(30),
        "PUBLICATION_ORDER_ORIGINAL"     VARCHAR2(30),
        "PUBLICATION_PARAGRAPH"          VARCHAR2(30),
        "PUBLICATION_PARAGRAPH_ORIGINAL" VARCHAR2(30),
        "NUMBER_OF_TASKS"                VARCHAR2(25),
        "LOG_SUMMARY"                    VARCHAR2(255),
        "COMMENTS" CLOB,
        "RELATED_LOGS" CLOB,
        "LPMANTAC_ID" NUMBER,
        PRIMARY KEY ("LPMANTAC_ID") ENABLE
      CREATE UNIQUE INDEX "SYS_IL0000077142C00035$$" ON "LPM"
    -- LPM_PARAGRAPH_MAPPING
    CREATE TABLE "LPM_PARAGRAPH_MAPPING_TABLE"
        "PUBLICATION_ORDER"       VARCHAR2(30),
        "PUBLICATION_PARAGRAPH"   VARCHAR2(30),
        "PARAGRAPH_ALIAS_MAPPING" VARCHAR2(30),
        "LPMTANTAC_ID"            NUMBER,
        PRIMARY KEY ("LPMTANTAC_ID") ENABLE
      CREATE UNIQUE INDEX "SYS_C0011587" ON "LPM_PARAGRAPH_MAPPING_TABLE"
        "LPMTANTAC_ID"
      -- PM_REQUIREMENTS_TABLE
    CREATE TABLE "PM_REQUIREMENTS_TABLE"
        "PUBLICATION_ORDER"            VARCHAR2(30),
        "PUBLICATION_PARAGRAPH_NUMBER" VARCHAR2(30),
        "DESCRIPTION"                  VARCHAR2(4000),
        "FREQUENCY"                    VARCHAR2(30),
        "CHECK_OR_MAINTENANCE"         VARCHAR2(22),
        "PRTANTAC_ID"                  NUMBER,
        PRIMARY KEY ("PRTANTAC_ID") ENABLE
      CREATE UNIQUE INDEX "SYS_C0011588" ON "PM_REQUIREMENTS_TABLE"
        "PRTANTAC_ID"
    REM INSERTING into LPM
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (108305902,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('07-MAY-10','DD-MON-RR'),'05/07/2010 3:24',to_date('07-MAY-10','DD-MON-RR'),'05/07/2010 3:28','05/07/2010 3:31','RADAR','SYS','SYSTEM','W','05/02/2010','05/02/2010 0:00',to_date('05-MAY-10','DD-MON-RR'),'05/05/2010 0:00',to_date('08-MAY-10','DD-MON-RR'),'05/08/2010 0:00','RADR',null,'6310.19A','6310.19A','161.K','161. K','1',null,1);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (108306002,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('02-MAY-10','DD-MON-RR'),'05/02/2010 21:00',to_date('02-MAY-10','DD-MON-RR'),'05/02/2010 21:30','05/03/2010 1:07','RADAR','SYS','CHAN B','W','05/02/2010','05/02/2010 0:00',to_date('05-MAY-10','DD-MON-RR'),'05/05/2010 0:00',to_date('08-MAY-10','DD-MON-RR'),'05/08/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,2);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (108306102,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('02-MAY-10','DD-MON-RR'),'05/02/2010 21:00',to_date('02-MAY-10','DD-MON-RR'),'05/02/2010 21:30','05/03/2010 1:07','RADAR','SYS','CHAN A','W','05/02/2010','05/02/2010 0:00',to_date('05-MAY-10','DD-MON-RR'),'05/05/2010 0:00',to_date('08-MAY-10','DD-MON-RR'),'05/08/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,3);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (104188702,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('29-APR-10','DD-MON-RR'),'4/29/2010 10:09',to_date('29-APR-10','DD-MON-RR'),'4/29/2010 10:11','4/29/2010 10:30','RADAR','SYS','SYSTEM','W','4/25/2010','4/25/2010 0:00',to_date('28-APR-10','DD-MON-RR'),'4/28/2010 0:00',to_date('01-MAY-10','DD-MON-RR'),'05/01/2010 0:00','RADR',null,'6310.19A','6310.19A','161.K','161. K','1',null,4);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (104188402,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('26-APR-10','DD-MON-RR'),'4/26/2010 13:33',to_date('26-APR-10','DD-MON-RR'),'4/26/2010 13:46','4/26/2010 15:23','RADAR','SYS','CHAN A','W','4/25/2010','4/25/2010 0:00',to_date('28-APR-10','DD-MON-RR'),'4/28/2010 0:00',to_date('01-MAY-10','DD-MON-RR'),'05/01/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,5);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (104188502,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('26-APR-10','DD-MON-RR'),'4/26/2010 13:33',to_date('26-APR-10','DD-MON-RR'),'4/26/2010 13:46','4/26/2010 15:23','RADAR','SYS','CHAN B','W','4/25/2010','4/25/2010 0:00',to_date('28-APR-10','DD-MON-RR'),'4/28/2010 0:00',to_date('01-MAY-10','DD-MON-RR'),'05/01/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,6);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (101223702,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 1:30',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 2:10','4/19/2010 3:12','RADAR','SYS','CHAN B','W','4/18/2010','4/18/2010 0:00',to_date('21-APR-10','DD-MON-RR'),'4/21/2010 0:00',to_date('24-APR-10','DD-MON-RR'),'4/24/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,7);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (101223802,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 1:30',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 2:10','4/19/2010 3:12','RADAR','SYS','CHAN A','W','4/18/2010','4/18/2010 0:00',to_date('21-APR-10','DD-MON-RR'),'4/21/2010 0:00',to_date('24-APR-10','DD-MON-RR'),'4/24/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,8);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (101223602,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 1:00',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 1:09','4/19/2010 3:12','RADAR','SYS','SYSTEM','W','4/18/2010','4/18/2010 0:00',to_date('21-APR-10','DD-MON-RR'),'4/21/2010 0:00',to_date('24-APR-10','DD-MON-RR'),'4/24/2010 0:00','RADR',null,'6310.19A','6310.19A','161.K','161. K','1',null,9);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (96642602,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('12-APR-10','DD-MON-RR'),'04/12/2010 10:25',to_date('12-APR-10','DD-MON-RR'),'04/12/2010 10:34','04/12/2010 17:49','RADAR','SYS','SYSTEM','W','04/11/2010','04/11/2010 0:00',to_date('14-APR-10','DD-MON-RR'),'4/14/2010 0:00',to_date('17-APR-10','DD-MON-RR'),'4/17/2010 0:00','RADR',null,'6310.19A','6310.19A','161.K','161. K','1',null,10);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (96642402,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('11-APR-10','DD-MON-RR'),'04/11/2010 11:10',to_date('11-APR-10','DD-MON-RR'),'04/11/2010 11:15','04/11/2010 12:51','RADAR','SYS','CHAN B','W','04/11/2010','04/11/2010 0:00',to_date('14-APR-10','DD-MON-RR'),'4/14/2010 0:00',to_date('17-APR-10','DD-MON-RR'),'4/17/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,11);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (96642302,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('11-APR-10','DD-MON-RR'),'04/11/2010 11:05',to_date('11-APR-10','DD-MON-RR'),'04/11/2010 11:10','04/11/2010 12:51','RADAR','SYS','CHAN A','W','04/11/2010','04/11/2010 0:00',to_date('14-APR-10','DD-MON-RR'),'4/14/2010 0:00',to_date('17-APR-10','DD-MON-RR'),'4/17/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,12);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (92805502,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 18:10',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 18:22','04/07/2010 19:04','RADAR','SYS','CHAN A','W','04/04/2010','04/04/2010 0:00',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 0:00',to_date('10-APR-10','DD-MON-RR'),'04/10/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,13);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (92805402,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 17:53',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 18:05','04/07/2010 19:04','RADAR','SYS','CHAN B','W','04/04/2010','04/04/2010 0:00',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 0:00',to_date('10-APR-10','DD-MON-RR'),'04/10/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null,14);
    Insert into LPM (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,LPMANTAC_ID) values (92805302,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 9:55',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 10:05','04/07/2010 10:29','RADAR','SYS','SYSTEM','W','04/04/2010','04/04/2010 0:00',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 0:00',to_date('10-APR-10','DD-MON-RR'),'04/10/2010 0:00','RADR',null,'6310.19A','6310.19A','161.K','161. K','1',null,15);
    REM INSERTING into PM_REQUIREMENTS_TABLE
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161A','Check transmitter average rf power output','WEEKLY',null,2);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161B','Check transmitter VSWR','WEEKLY',null,3);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161C','Check RMS transmitter pulse width','WEEKLY',null,4);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(1)','Check filament current','WEEKLY',null,5);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(2)','Check focus coil current','WEEKLY',null,6);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(3)','Check Klystron voltage','WEEKLY',null,7);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(4)','Check Klystron current','WEEKLY',null,8);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(5)','Check PFN voltage','WEEKLY',null,9);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(6)','Check vacuum pump current','WEEKLY',null,10);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161E','Check target receiver MDS','WEEKLY',null,11);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161F','Check target receiver NF','WEEKLY',null,12);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161G','Check target receiver recovery','WEEKLY',null,13);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161H','Check weather receiver MDS','WEEKLY',null,14);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161I','Check weather receiver NF','WEEKLY',null,15);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161J','Check weather receiver recovery','WEEKLY',null,16);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161K','Check spare modem operation','WEEKLY',null,17);
    REM INSERTING into LPM_PARAGRAPH_MAPPING_TABLE
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161A','161',26);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161A','161A-J',27);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161B','161',28);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161B','161A-J',29);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161',30);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161A-J',31);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161(A-->K)',32);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161(A-K)',33);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161.(A-C).',34);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(1)','161',35);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(1)','161161 A-J',36);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(1)','161(A-->K)',37);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(1)','161(A-D)',38);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(2)','161',39);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(2)','161 A-J',40);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(2)','161(A-->K)',41);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161E','161E/H',42);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161F','161E/H',43);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161G','161E/H',44);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161H','161E/H',45);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161K','161.K',46);Edited by: George Heller on Jul 15, 2011 11:09 AM

  • Sum in sql

    I have two tables in oracle 10g
    id............code..........name
    1..............10...........local1
    2..............20...........local2
    3..............30...........local3
    id.............local..............created
    1...............1..............12.11.2010
    2...............2..............16.11.2010
    3...............3..............12.11.2010
    4...............6..............08.10.2010
    select s.name,s.code,
    TO_CHAR(p.created,'MM') month,
    count(p.id)
    from local s,made p
    where p.local = s.id
    GROUP BY s.name,s.code,TO_CHAR(p.created,'MM')
    ORDER BY s.code
    After I get my query:
    how much each month something local made
    How do I get for each local total of all months.
    local1..............10..............1..................57
    ......................................2..................63
    ......................................3..................23
    sum...................................................XXX
    local2..............20..............1.................34
    ......................................2.................72
    ......................................3.................68
    sum..................................................XXX
    and so on.
    thanks

    BREAK ON name
    COMPUTE SUM OF amount ON name
    select s.name,s.code,
    TO_CHAR(p.created,'MM') month,
    count(p.id) amount
    from local s,made p
    where p.local = s.id
    GROUP BY s.name,s.code,TO_CHAR(p.created,'MM')
    ORDER BY s.code;

  • How to call pl/sql function from element values

    EBS 11.5.10.2
    XMLP 5.6.3
    Hello,
    I noticed that the output of the rdf-to-data template conversion process makes use of an undocumented feature of data templates, and I would like to get input from experts as to which situations this feature is usable.
    The closest thing I can find in the documentation is a sample in the user guide. There is a "General Ledger Journals Data Template Example" that has a <dataStructure> section that contains <element> nodes which are NOT children of a <group> node. I can't find any explanation of this in the user guide.
    I've noticed from converted templates that in these un-grouped elements you can make calls to PL/SQL functions in the "value" attribute, like this:
    <dataStructure>
      <group name="G_LINES" source="Q_MAIN">
        <element name="Line_Num"           value="Line_Num"/>
      </group>
      <element name="C_CALCULATED_VALUE" dataType="number" value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
    </dataStructure>Has anyone had any success being able to call PL/SQL functions from grouped elements? Whenever I try, it doesn't seem to work.
    When I try something like this:
    <dataStructure>
      <group name="G_LINES" source="Q_MAIN">
        <element name="Line_Num"           value="Line_Num"/>
        <element name="some_calculation"   value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
        <element name="some_calculation_b" value="XX_CUSTOMPROCS.SOME_FUNCTION_B(:Line_Num)"/>
      </group>
      <element name="C_CALCULATED_VALUE" dataType="number" value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
    </dataStructure>The <SOME_CALCULATION/> and <SOME_CALCULATION_B/> nodes come out empty in the output data xml file, but <C_CALCULATED_VALUE> would have a value as desired.

    ah - perfect. That makes sense. Thank you for the response!
    But what about when we need to pass parameters to those functions whos values are the results of aggregate element values?
    This happens a lot in the converted data templates, where pl/sql package functions are meant to replace formula columns from the original Oracle Report. Take this example from the conversion of ARXAGMW.rdf (Aging Report, 7 Buckets):
    (note the function call in the value of "Set_Percent_Inv_Inv" is using aggregate results from subgroups)
      <group name="G_INV_INV" dataType="varchar2" source="Q_Invoice">
        <element name="Total_Inv_Inv_Amt" function="sum" dataType="number" value="G_Invoice.C_Amt_Due_Rem_Inv"/>
        <element name="Total_Inv_Inv_B0" function="sum" dataType="number" value="G_Invoice.C_Inv_B0"/>
        <element name="Total_Inv_Inv_B1" function="sum" dataType="number" value="G_Invoice.C_Inv_B1"/>
        <element name="Total_Inv_Inv_B2" function="sum" dataType="number" value="G_Invoice.C_Inv_B2"/>
        <element name="Total_Inv_Inv_B3" function="sum" dataType="number" value="G_Invoice.C_Inv_B3"/>
        <element name="Total_Inv_Inv_B4" function="sum" dataType="number" value="G_Invoice.C_Inv_B4"/>
        <element name="Total_Inv_Inv_B5" function="sum" dataType="number" value="G_Invoice.C_Inv_B5"/>
        <element name="Total_Inv_Inv_B6" function="sum" dataType="number" value="G_Invoice.C_Inv_B6"/>
        <element name="Set_Percent_Inv_Inv"  dataType="number"  value="XX_CUSTOMPROCS.XXC_ARXAGMW.set_percent_inv_invformula(:Total_Inv_Inv_Amt, :Total_Inv_Inv_B0, :Total_Inv_Inv_B1, :Total_Inv_Inv_B2, :Total_Inv_Inv_B3, :Total_Inv_Inv_B4, :Total_Inv_Inv_B5, :Total_Inv_Inv_B6)"/>
        <element name="Sum_Percent_B0_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B0_Inv_p"/>
        <element name="Sum_Percent_B1_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B1_Inv_p"/>
        <element name="Sum_Percent_B2_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B2_Inv_p"/>
        <element name="Sum_Percent_B3_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B3_Inv_p"/>
        <element name="Sum_Percent_B4_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B4_Inv_p"/>
        <element name="Sum_Percent_B5_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B5_Inv_p"/>
        <element name="Sum_Percent_B6_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B6_Inv_p"/>
        <group name="G_Cust_Inv" dataType="varchar2" source="Q_Invoice">
          <group name="G_Site_Inv" dataType="varchar2" source="Q_Invoice">
            <group name="G_1" dataType="varchar2" source="Q_Invoice">
              <group name="G_Invoice" dataType="varchar2" source="Q_Invoice">
                <element name="C_Amt_Due_Rem_Inv" dataType="number" value="C_Amt_Due_Rem_Inv"/>
                <element name="C_Inv_B0" dataType="number" value="C_Inv_B0"/>
                <element name="C_Inv_B1" dataType="number" value="C_Inv_B1"/>
                <element name="C_Inv_B2" dataType="number" value="C_Inv_B2"/>
                <element name="C_Inv_B3" dataType="number" value="C_Inv_B3"/>
                <element name="C_Inv_B4" dataType="number" value="C_Inv_B4"/>
                <element name="C_Inv_B5" dataType="number" value="C_Inv_B5"/>
                <element name="C_Inv_B6" dataType="number" value="C_Inv_B6"/>
              </group>
            </group>
          </group>
        </group>
      </group>
      ...All of these groups and sub-groups are based on one single query, so I am not sure how I would move the function call into the query without changing the results of the function.
    In the example above, elements Sum_Percent_B0_Inv through Sum_Percent_B6_Inv grab the results of the calculation done in set_percent_inv_invformula. Here is the essence of that function:
      sum_percent_b0_inv := ROUND ((total_inv_inv_b0 / total_inv_inv_amt) * 100, 2);
      sum_percent_b1_inv := ROUND ((total_inv_inv_b1 / total_inv_inv_amt) * 100, 2);
      sum_percent_b2_inv := ROUND ((total_inv_inv_b2 / total_inv_inv_amt) * 100, 2);
      sum_percent_b3_inv := ROUND ((total_inv_inv_b3 / total_inv_inv_amt) * 100, 2);
      sum_percent_b4_inv := ROUND ((total_inv_inv_b4 / total_inv_inv_amt) * 100, 2);
      sum_percent_b5_inv := ROUND ((total_inv_inv_b5 / total_inv_inv_amt) * 100, 2);
      sum_percent_b6_inv := ROUND ((total_inv_inv_b6 / total_inv_inv_amt) * 100, 2);The only solution I can think of is to have separate queries, one for each subgroup, that do the "sum" in sql; but that seems terribly inefficient.

  • Dao and sql

    Dear All,
    In SQL we can find out the SUM of some datas, or we can get the datas by using select query and do the sum in DAO classes using StingBuffer.
    i need to know here,
    If i write SUM in query, is it processing speed will be low? or if i make sum in dao classes is it processing speed is faster? which one is good for better performance compared, writing in DAO classes is better or Sum in sql query is better?
    Thanks a lot in Adv

    It is entirely dependent on your design. If you fetch the records from two different tables via JDBC with no cache, the performance would be slower than doing the sum in the DB engine over large intervals based on the complexity of the query etc. This does not merit doing it with SUM though, it is entirely a design decision.

  • Sum by row

    Hello folks,
    I am looking for a way to get a sum column in this query:
    select *
      from (select 1 as ID, 10 as Value, '1.1.2001' as dat_e
              from dual
            union all
            select 2, 15, '2.2.2002'
              from dual
            union all
            select 3, 10, '3.3.2003'
              from dual
              union all
            select 4, 10, '4.4.2004'
              from dual)The result I am looking for is a column that adds values like this:
    10
    25
    35
    45
    Best regards,
    Igor

    Analytic version of the SUM function :
    SQL> with t as  (
      2    select 1 as ID, 10 as Value, '1.1.2001' as dat_e from dual union all
      3    select 2, 15, '2.2.2002'          from dual        union all
      4    select 3, 10, '3.3.2003'          from dual        union all
      5    select 4, 10, '4.4.2004'          from dual
      6  )
      7  select id
      8       , sum(value) over(order by id) as cumul_val
      9  from t ;
            ID  CUMUL_VAL
             1         10
             2         25
             3         35
             4         45

  • 2 right joins - how to add another right join to this statement?

    Hi all,
    I had to upgrade my sql statement and add another column. my previuos sql was:
              SELECT TR.ID, TA.Name, TR.idTarget, TR.Controller_Status, TR.previuosYear, TR.deduction, TR.idProduction, SUM(CSV.cur_amount) AS Accumulated,    PD.Name AS PName, PD.type_2, CL.ToRange AS growth
              FROM agent AS TA, production_name AS PD, calculation AS CL, target AS TR
              RIGHT JOIN csv_production AS CSV ON CSV.ID=TR.ID AND CSV.Production_Date BETWEEN '2006-10-01' AND '2006-12-31'
              WHERE TA.ID=TR.ID
              AND PD.idProduction = TR.idProduction
              AND CL.idCalculation = ANY (SELECT MIN(idCalculation) FROM calculation GROUP BY idProduction)
              AND TR.idProduction=CL.idProduction
              AND TR.startDate= '2006-10-01' AND TR.endDate='2006-12-31'
              GROUP BY CSV.IDI had to add this line:
    RIGHT JOIN csv_net_production AS CSV_net ON CSV_net.IATA=TR.IATA AND CSV_net.Production_Date BETWEEN '2006-10-01' AND '2006-12-31'  my end result looks like this:
              SELECT TR.ID, TA.Name, TR.idTarget, TR.Controller_Status, TR.previuosYear, TR.deduction, TR.idProduction, SUM(CSV.cur_amount) AS Accumulated,  SUM(CSV_net.cur_amount) AS net_Accumulated, PD.Name AS PName, PD.type_2, CL.ToRange AS growth
              FROM agent AS TA, production_name AS PD, calculation AS CL, target AS TR
              RIGHT JOIN csv_production AS CSV ON CSV.ID=TR.ID AND CSV.Production_Date BETWEEN '2006-10-01' AND '2006-12-31'
                               RIGHT JOIN csv_net_production AS CSV_net ON CSV_net.ID=TR.ID AND CSV_net.Production_Date BETWEEN '2006-10-01' AND '2006-12-31' 
              WHERE TA.ID=TR.ID
              AND PD.idProduction = TR.idProduction
              AND CL.idCalculation = ANY (SELECT MIN(idCalculation) FROM calculation GROUP BY idProduction)
              AND TR.idProduction=CL.idProduction
              AND TR.startDate= '2006-10-01' AND TR.endDate='2006-12-31'
              GROUP BY CSV.IDBUT!!! the accumulated (Accumulated, net_Accumulated,) is multiplied by 3, which means that I must add another WHERE statement (i think?!)
    thanks for any pointers

    how do u relate csv_production ,csv_net_production ?
    the one comparison i viewed is TR.ID against the IDs of these 2 tables
    I mean
    is there any relationship between these 2 tables?
    specifically
    is there any referencial integrity or like constraint exists between these 2 tables?
    if so u can write a where condition csv_production.ID=csv_net_production.ID

  • Add Time value to a Date value

    Hi
    COLUMN A is a DATE TYPE i.e. *14-MAR-13 12:30*
    COLUMN B is a CHAR Type for hours and minutes: i.e. *01:45*.
    I'm trying to sum (in SQL) the time in Col A with Col B, the result should be: 14:15
    I'm not too sure how to proceed
    THanks
    Ruben

    Ruben_920841 wrote:
    Hi Frank,
    Thank you for your quick reply.
    However, I'm not sure I understand why you insert "TRUNC (b_date)" in your code below. Can you please explain?
    >
    WITH     got_b_date     AS
         SELECT     a, b
         ,     TO_DATE (b, 'HH24:MI')     AS b_date
         FROM     table_x
    SELECT     a, b
    ,     a + ( b_date
         - TRUNC (b_date)
         )      AS a_plus_b
    FROM table_x
    >TO_DATE (b, 'HH24:MI') converts a string (such as '01:45') into a DATE (such as 1:45 AM on April 1, 2013). Since we're not passing a day of the month, month or year, those all take default values.
    If d is a DATE, then TRUNC (d) is the earliest DATE (miodnight) on the same calendar day.
    If d1 and d2 are DATEs, then d1 - d2 is the number of days (not necessarily an integer) that d1 is after d2.
    If d is a DATE and n is a NUMBER (not necessarily an integer), then d + n is a DATE n days after d.
    Put this all together and what do we have, given that b is '01:45'
    b_date is 1:45 AM on some default day (for this solution, it doesn't matter which day)
    TRUNC (b_date) is midnight on that same calendar day.
    b_date - TRUNC (b_date) is a NUMBER, the number of days that 1:45 is after midnight (1:45 is 1.75 hours, and a day is 24 hours, so that comes to 1.75 / 24 = .072916666... days.)
    a + (b_date - TRUNC (b_date)) is a DATE, .072916666... days (that is, 1.75 hours) after a.
    Notice that Solomon did almost the same thing, only Solomon used the fact that the default day of the month in TO_DATE is 1, and that the default month and year are the same month and year that SYSDATE returns, so b_date - TRUNC (b_date) is the same as b_date - TRUNC (SYSDATE, 'MONTH').

  • Need to calculate subtotal and print it on basis of dc,store and lid number

    Hi Expert
    I need to calculate sub total for couple of fields on the basis of DC, store and lid number. I have clculated the sub total in query level but while printing it in the report i am facing the real problem.
    Please find the example:
    For DC=1111, store=2222, lid no=3333
    QTY rcvd qty ordered qty available REFNO
    20 300 680 7859
    45 258 348 4528
    For DC=1111, store=2222, lid no=3334
    QTY rcvd qty ordered qty available REFNO
    58 78 69 1487
    45 54 74 2578
    i want the sum in below of completion of one set of values. but as i am calculating the sum in sql query , i put it in a group and it is appearing in the end of every line which is not my desired.
    Kindly let me know how to do the grouping so that i can get it in the end of each combination of DC,store, lid no.
    Thanks in advance.
    Regards
    Srikant

    Can you send me the xml and RTF template to [email protected] ? I will take a look.
    Thanks,
    Bipuser

  • Column Not Displayed in Universe

    Hi,
    I can't see column in Universe. I'm connecting to SAP Tables using ODBC. My database is MaxDB. My platform is Windows 32-bit. I'm using BO Edge XI 3.1. Here is my original PRM file.
    <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE DBParameters SYSTEM "../dbparameters.dtd"><DBParameters>
         <Configuration>
              <Parameter Name="DB_TYPE">GENERIC</Parameter>
              <Parameter Name="SORT_BY_NO">YES</Parameter>
              <Parameter Name="GROUPBYCOL">NO</Parameter>
              <Parameter Name="EXT_JOIN">NO </Parameter>
              <Parameter Name="CONCAT">+</Parameter>
              <Parameter Name="UNION"></Parameter>
              <Parameter Name="UNION_IN_SUBQUERY"></Parameter>
              <Parameter Name="INTERSECT"></Parameter>
              <Parameter Name="INTERSECT_IN_SUBQUERY"></Parameter>
              <Parameter Name="MINUS"></Parameter>
              <Parameter Name="MINUS_IN_SUBQUERY"></Parameter>
              <Parameter Name="OWNER">Y</Parameter>
              <Parameter Name="QUALIFIER">Y</Parameter>
              <Parameter Name="COMMA">' '</Parameter>
              <Parameter Name="NO_DISTINCT">Y</Parameter>
              <Parameter Name="REFRESH_COLUMNS_TYPE">T</Parameter>
              <Parameter Name="CHECK_OWNER_STATE">Y</Parameter>
              <Parameter Name="CHECK_QUALIFIER_STATE">Y</Parameter>
              <Parameter Name="KEY_INFO_SUPPORTED">N</Parameter>
              <Parameter Name="OUTERJOINS_GENERATION">NO</Parameter>
              <Parameter Name="EVAL_WITHOUT_PARENTHESIS">N</Parameter>
              <Parameter Name="USER_INPUT_DATE_FORMAT">{\d 'yyyy-mm-dd'}</Parameter>
            <Parameter Language="ja" Name="USER_INPUT_DATE_FORMAT">{!d 'yyyy-mm-dd'}</Parameter>
              <Parameter Name="USER_INPUT_NUMERIC_SEPARATOR">.</Parameter>
         </Configuration>
         <DateOperations>
              <DateOperation Name="YEAR">{fn year($D)}</DateOperation>
              <DateOperation Name="MONTH">{fn month($D)}</DateOperation>
         </DateOperations>
         <Operators>
              <Operator Arity="1" ID="ADD" Type="Numeric">+</Operator>
              <Operator Arity="1" ID="SUBSTRACT" Type="Numeric">-</Operator>
              <Operator Arity="1" ID="MULTIPLY" Type="Numeric">*</Operator>
              <Operator Arity="1" ID="DIVIDE" Type="Numeric">/</Operator>
              <Operator Arity="0" ID="NOT_NULL" Type="Logical">IS NOT NULL</Operator>
              <Operator Arity="0" ID="NULL" Type="Logical">IS NULL</Operator>
              <Operator Arity="1" ID="SUP" Type="Logical">&gt;=</Operator>
              <Operator Arity="1" ID="INF" Type="Logical">&lt;=</Operator>
              <Operator Arity="1" ID="EQUAL" Type="Logical">=</Operator>
              <Operator Arity="1" ID="DIFF" Type="Logical">&lt;&gt;</Operator>
              <Operator Arity="1" ID="STRICT_SUP" Type="Logical">&gt;</Operator>
              <Operator Arity="1" ID="STRICT_INF" Type="Logical">&lt;</Operator>
              <Operator Arity="1" ID="IN_LIST" Type="Logical">IN</Operator>
              <Operator Arity="1" ID="NOT_IN_LIST" Type="Logical">NOT IN</Operator>
              <Operator Arity="1" ID="MATCH" Type="Logical">LIKE</Operator>
              <Operator Arity="1" ID="NOT_MATCH" Type="Logical">NOT LIKE</Operator>
              <Operator Arity="2" ID="BETWEEN" Type="Logical">BETWEEN  AND</Operator>
              <Operator Arity="2" ID="NOT_BETWEEN" Type="Logical">NOT BETWEEN  AND</Operator>
         </Operators>
         <Functions>
              <Function Distinct="False" Group="True" ID="Minimum" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>min($1)</SQL>
              </Function>
              <Function Distinct="False" Group="True" ID="Maximum" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>max($1)</SQL>
              </Function>
              <Function Distinct="False" Group="True" ID="Average" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>avg($1)</SQL>
              </Function>
              <Function Distinct="False" Group="True" ID="Sum" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>sum($1)</SQL>
              </Function>
              <Function Distinct="False" Group="True" ID="Count" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="All"></Argument>
                   </Arguments>
                   <SQL>count($1)</SQL>
              </Function>
              <Function Group="False" ID="ASCII_code" InMacro="False" Type="String">
                   <Arguments>
                        <Argument Type="Char"></Argument>
                   </Arguments>
                   <SQL>{fn ascii($1)}</SQL>
              </Function>
              <Function Group="False" ID="Character" InMacro="False" Type="String">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn char($1)}</SQL>
              </Function>
              <Function Group="False" ID="Concat" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn concat($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Left" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn left($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="LeftRemove" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn ltrim($1)}</SQL>
              </Function>
              <Function Group="False" ID="Length" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn length($1)}</SQL>
              </Function>
              <Function Group="False" ID="Locate" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn locate($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Lowercase" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn lcase($1)}</SQL>
              </Function>
              <Function Group="False" ID="Repeat" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn repeat($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Rightpart" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn right($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Rtrim" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn rtrim($1)}</SQL>
              </Function>
              <Function Group="False" ID="Substring" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn substring($1,$2,$3)}</SQL>
              </Function>
              <Function Group="False" ID="Uppercase" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn ucase($1)}</SQL>
              </Function>
              <Function Group="False" ID="Absolute" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn abs($1)}</SQL>
              </Function>
              <Function Group="False" ID="Arc_cosine" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn acos($1)}</SQL>
              </Function>
              <Function Group="False" ID="Arc_sine" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn asin($1)}</SQL>
              </Function>
              <Function Group="False" ID="Arc_tangent" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn atan($1)}</SQL>
              </Function>
              <Function Group="False" ID="Angle_Tangent_2" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn atan2($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Cosine" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn cos($1)}</SQL>
              </Function>
              <Function Group="False" ID="Ceil" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn ceiling($1)}</SQL>
              </Function>
              <Function Group="False" ID="Exp" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn exp($1)}</SQL>
              </Function>
              <Function Group="False" ID="Floor" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn floor($1)}</SQL>
              </Function>
              <Function Group="False" ID="Log" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn log($1)}</SQL>
              </Function>
              <Function Group="False" ID="Mod" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn mod($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Pi" InMacro="False" Type="Numeric">
                   <SQL>{fn pi()}</SQL>
              </Function>
              <Function Group="False" ID="Random" InMacro="False" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn rand($1)}</SQL>
              </Function>
              <Function Group="False" ID="Sign" InMacro="False" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn sign($1)}</SQL>
              </Function>
              <Function Group="False" ID="Sine" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn sin($1)}</SQL>
              </Function>
              <Function Group="False" ID="Sqrt" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn sqrt($1)}</SQL>
              </Function>
              <Function Group="False" ID="Tangent" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn tan($1)}</SQL>
              </Function>
              <Function Group="False" ID="Character_prompt" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>@prompt($1,'A',,,)</SQL>
              </Function>
              <Function Group="False" ID="Numeric_prompt" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>@prompt($1,'N',,,)</SQL>
              </Function>
              <Function Group="False" ID="Date_prompt" InMacro="True" Type="DateTime">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>@prompt($1,'D',,,)</SQL>
              </Function>
         </Functions>
    </DBParameters>
    Assistance is much appreciated. Thank you.
    Rgds,
    Hapizorr

    Hi
    this is a rather unconventional and not officially supported way to access SAP data. Some of the table fields as you see them in SAP R3 do not have corresponding fields in the underlying database.
    If you want to build reports on SAP R3 table you have the following options:
    1) Use the SAP rapid marts and extract your R3 data into a DWH based on a relational database. You also get a universe on which you can build your reports.
    2) You can use Crystal Reports and the native R3 table driver
    3) There is also a prototype (This is NOT a product) R3 connector for the Data FEderator that will allo you to build relational universes on SAP R3 sources.
    4) Load your data into a BW system and build OLAP universes on top of BEx queries.
    Regards,
    Stratos

  • GROUP BY in Desktop Intelligence

    Question: Is there a way to use GROUP BY statement at the Universe level?
    Detailed Example: I have Cricket Teams and Team Members. I want to display all the team members for a team in a single cell as comma separated values. At database level, I can achieve this by using an oracle function (stringagg) as follows:
    SELECT Team, stringagg(Team_Members)
    FROM Cricket_Team
    GROUP BY Team
    In Business Objects Universe, I have created two objects:
    1> Team as Cricket_Team.Team
    2> Team Members as stringagg(Team_Members)
    When I drag these two objects in the report I get DA0005 error (Exception: DBD, ORA-00937: not a single-group group function
    State: N/A)
    This is because the SQL generated by Desktop Intelligence is
    SELECT Team, stringagg(Team_Members)
    FROM Cricket_Team
    I can fix this at reporting level by customizing the SQL, but I want this to be fixed at the Universe level so that all the users can get the Team_Members list in comma separated values for each Team.
    So, is there a way to get this GROUP BY Team statement at the Universe level?

    Hello,
    You cannot do this in the universe.
    As we are using BO6.5 the solution written below is based on that, but because deski hasn't changed much since then it still might work the same (but you need to check for yourself).
    What you can do is adjust the prm-file (parameter file) for Oracle (oracle.prm).
    You can find it in the folder (=our default installation folder for BO6.5): C:\Program Files\Business Objects\BusinessObjects Enterprise 6\dataAccess\RDBMS\connectionServer\oracle
    In the file the functions are listed which generate a GROUP BY.
    <Function Group="False" ID="Substring" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>substr($1,$2,$3)</SQL>
    </Function>
    <Function Group="True" ID="Sum" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>sum($1)</SQL>
    </Function>
    Above 2 examples from the oracle.prm file whe 'Substring' will not generate a GROUP BY and 'Sum' will.
    What you could do is add the 'stringagg' function (after making a copy of the original oracle.prm file) and see if it works.
    Regards,
    Harry

  • Group by with outer join

    Group by sum doesn't work with outer join. Can anyone please help me to get it right?
    I've posted some sample data and queries below:
    CREATE TABLE COMPLAINT
      CNO     NUMBER,
      REASON  VARCHAR2(15 BYTE),
      TOTAL   NUMBER
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (1, 'edge', 250);
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (2, 'edge', 250);
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (3, 'brst', 300);
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (4, 'crea', 400);
    COMMIT;
    CREATE TABLE SCOTT.COMPLAINTROLL
      CNO   NUMBER,
      ROLL  VARCHAR2(15 BYTE)
    SET DEFINE OFF;
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (2, 'roll22');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll4');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll3');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll2');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll1');
    COMMIT;
    select * from complaint
    CNO     REASON     TOTAL
    1     edge     250
    2     edge     250
    3     brst     300
    4     crea     400
    select * from complaintroll
    CNO     ROLL
    1     roll1
    1     roll2
    1     roll3
    1     roll4
    2     roll22
    -- total of reason code edge is 500
    select reason,sum(total)
    from complaint c
    group by reason
    REASON     SUM(TOTAL)
    brst     300
    crea     400
    edge     500
    -- total of reason code edge after outer join is 1250
    select reason,sum(total)
    from complaint c,complaintroll cr
    where c.cno=cr.cno(+)
    group by reason
    REASON     SUM(TOTAL)
    brst     300
    crea     400
    edge     1250
    {\code}
    Thanks for reading this post.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The problem that you described is simple. The outer join duplicates all the rows from the parent table (complaint). If you want to sum a column from the parent table, then this sum includes all the duplicated rows.
    There are several solutions for this problem.
    A) One had been shown already by Cenutil. Instead of doing an outer join, you can do a subquery in the select clause that delivers the additional information from the detail table.
    SQL> select reason,
       sum(total),
       sum((select count(*) from complaintroll cr where c.cno=cr.cno)) cnt_rolls
    from complaint c
    group by c.reason;
    REASON          SUM(TOTAL)  CNT_ROLLS
    crea                   400          0
    brst                   300          0
    edge                   500          5b) sum in two steps. First sum and count including the join criteria, then use this information to calculate the correct total sum.
    SQL> select reason, sum(stotal), sum(stotal/scount), sum(scount), sum(cnt_rolls)
      2  from (select reason, sum(total) stotal, count(*) scount, count(cr.cno) cnt_rolls
      3         from complaint c
      4         left join complaintroll cr on c.cno=cr.cno
      5         group by reason, c.cno
      6         )
      7   group by reason;
    REASON          SUM(STOTAL) SUM(STOTAL/SCOUNT) SUM(SCOUNT) SUM(CNT_ROLLS)
    crea                    400                400           1              0
    brst                    300                300           1              0
    edge                   1250                500           5              5
    sql> c) another option is to do the left join, but do the aggregation only one time for the parent table. Analytic functions are helpful for that. However since analytic fuinctions can't be used inside an aggregation function, we would again need an inline view.
    SQL> select reason, sum(case when rn = 1 then total end) sum_total, count(*), count(crcno)
      2  from (select row_number() over (partition by c.reason order by c.cno) rn,
      3                   c.*, cr.cno crcno
      4         from complaint c
      5         left join complaintroll cr on c.cno=cr.cno
      6         )
      7  group by reason;
    REASON           SUM_TOTAL   COUNT(*) COUNT(CRCNO)
    brst                   300          1            0
    crea                   400          1            0
    edge                   250          5            5
    SQL> Edited by: Sven W. on Feb 10, 2011 1:00 PM - formatting + column added to 2nd option

  • Interpret DB CPUwait event (top 5 wait event AWR)

    Hi,
    Can anyone tell me how to read the table below especially the "DB CPU" section,
    Is it right to say that 41.71% of time was consumed waiting for CPU?? this is urgent
    Event                     Waits           Time(s)      Avg wait (ms)      % DB time      Wait Class
    db file sequential read      300,835      1,483           5           58.42           User I/O
    DB CPU                     1,059                     41.71
    reliable message           9,499           18           2           0.71           Other
    PX Deq: Slave Session Stats      6,506           11           2           0.43           Other
    gc cr grant 2-way           26,218           6           0           0.25           Cluster

    user589420 wrote:
    Hi,
    Can anyone tell me how to read the table below especially the "DB CPU" section,
    Is it right to say that 41.71% of time was consumed waiting for CPU?? this is urgent
    Event                           Waits  Time(s)  Avg wait (ms)  % DB time  Wait Class
    db file sequential read       300,835    1,483              5      58.42  User I/O
    DB CPU                                   1,059                     41.71
    reliable message                9,499       18              2       0.71  Other
    PX Deq: Slave Session Stats     6,506       11              2       0.43  Other
    gc cr grant 2-way              26,218        6              0       0.25  Cluster
    When posting information to the forum that includes critical spaces, like the above, use a { code } tag (without spaces) before and after the information.
    I do not understand why this question is an urgent problem.
    It is incorrect to state that 41.71% of the time was consumed waiting for the CPU. When an Oracle process is running on the CPU, it is officially not waiting. It causes a bit of confusion having the CPU time consumed listed among the top 5 wait events, but as long as you understand why it is in the top 5 list, it almost makes sense for it to be included.
    The DB CPU statistic is listed as 1,059 seconds. If the duration of this report is 1 hour, that is 3,600 seconds of total time. If there is a single CPU in the server, there are 3,600 CPU seconds available in the time period, indicating that the server's CPU on average was 29.4% busy. If there were 12 CPUs in the server, there were 43,200 CPU seconds available in the time period, indicating that on average the CPUs were 2.5% busy. Does this mean that there was a problem, or was this OK, or is there not enough information? Just because on average the CPUs are not busy, that does not mean that there were not periods of intense CPU competion, where in fact there was a temporary shortage of available CPU time for processing.
    The DB Time statistic is supposed to be an indication of work performed by the instance on behalf of the user sessions. It is the accumulation of CPU time consumed by foreground sessions plus the accumulated sum of all non-idle wait events consumed by foreground sessions. Blog articles that might be of interest to you:
    http://hoopercharles.wordpress.com/2010/01/13/working-with-oracle-time-model-data/
    http://hoopercharles.wordpress.com/2010/02/05/faulty-quotes-6-cpu-utilization/
    Charles Hooper
    Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
    http://hoopercharles.wordpress.com/
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • Comparing date in SUMIFS

    Hi!
    Trying to achieve an automatic accumulated sum of hours depending on weeknumber and date. According to Numbers help, you're supposed to be able to compare dates, but I can't seem to get it right...:)
    Here's an example:
    !http://opheim.com/div/accumulated.png!
    I've filled in the last coloumn manually now to show what I want.
    My guess would be to put the following formula into G2:
    =SUMIFS($G$2:$G$366;$A$2:$A$366;A2;$C$2:$C$366;<=C2)
    Point would be to add hours (in F - "Timer") if weeknumber (A) is the same as the given day, and date is same or earlier than given day. I've also tried to put the test-value in "" or '' but it gives the same result.
    A is automatic: =WEEKNUM(C2;2)
    B is automatic: =DAYNAME(C2)
    C is just the range of the year
    D is start time
    E is end time
    F is duration between D and E
    G should be the accumulated hours of that particular week
    Any ideas here?
    (PS: English software on international system, so I use ; to separate values)
    Best regards,
    H. Opheim

    Here is my bug report:
    Your tracking number for this issue is Bug ID# 6598321.
    Hello.
    Attached is a Numbers document demonstrating a serious design flaw.
    On a system whose date format is dd/mm/yyyy
    the formula in cell C7 is
    =SUMIF($A;"<=15/2/2009";B)
    If I open it on a system whose date format is mm/dd/yyyy it remains:
    =SUMIF($A;"<=15/2/2009";B)
    which is perfectly odd
    To be correct it would be:
    =SUMIF($A;"<=2/15/2009";B) (the one used in D7)
    I guess that you can't transcode the embedded date but what is very annoying is the fact that there is no workaround.
    If we store in a cell the date to compare, we aren't allowed to use a formula like
    =SUMIF($A;"<=cellRef";B)
    the only way we are allowed to use a cellRef is
    =SUMIF($A;cellRef;B)
    which of course can't fit our needs.
    It's highly annoying.
    This awful feature strikes in
    AVERAGEIF, AVERAGEIFS
    COUNTIF, COUNTIFS
    SUMIF, SUMIFS
    Sure, to do what is done in the example I may use an other formula which would not use SUMIF but here it's just a way to demonstrate the design flaw.
    <img src="http://homepage.mac.com/koenigyvan/.Pictures/forum/200902/2009_0218.jpg">
    in cell C7, the formula is:
    =SUMIF($A,"<=15/2/2009",$B) (OK for dd/mm/yyyy systems)
    in cell D7 it is:
    =SUMIF($A,"<=2/15/2009",$B) (OK for mm/dd/yyyy systems)
    in cell E7 the formula is an attempt to use a cellRef:
    =SUMIF($A,<=A,B)
    Once again, in this thread, I'm forced to paste the link to screenshot twice
    Yvan KOENIG (from FRANCE mercredi 18 février 2009 15:09:57)

  • Large number display problem

    I get an number from my db column (SQL2000), and I need to display a accumulative sum of that column.
    I am now facing a problem of the automatic convertion of the sum when it is greater than 9999999.
    For example, when the sum is now 12345678 it will automatically convert it into 1.2345678E8.
    Please tell me how to solve it. I want the float to display exactly 12345678.
    Besides, when I want to display the float as in the format of 12,345,678, please tell me how I can do it.
    I list part of my coding for your reference.
    float accumTot = 0;
    accumTot = accumTot + Float.parseFloat(salamt.getTotAmt());
    out.println("<td width='15%'><p>"+accumTot+"</p></td>");
    Many Thanks

    java.text.NumberFormat will have your solution:
    NumberFormat nf = NumberFormat.getInstance();
    <%= nf.format(accumTot) %>
    Be aware of the rounding errors involved in using floating point:
    What Every Computer Scientist Should Know About Floating-Point Arithmetic
    Are the numbers whole numbers (ie no decimals)? then you should be using an int/long
    Otherwise you should probably be using doubles.

Maybe you are looking for

  • Java mapping runtime issue

    Hi, I have currently created a java mapping which unzips files and transforms plain text/falt files to xml according to a specific structure... So far so good. This stuff works perfectly when testing interface mapping in the repository. However at ru

  • Trouble with internal microphone and display

    Hello together, I just installed Arch on my Laptop yesterday. Everything works fine now, except for two things: 1) The internal microphone does not work at all. I already checked all settings in alsamixer/amixer and I also tried this, but it won't he

  • The attempt to burn a disk failed. An unknown error occurred (261)

    ... and then??? talk about a lack of support. Can't backup iTunes to DVD (have been successful in the past) and can't contact support. What good is this program??? (Two hours wasted makes for frustrated consumer.)

  • Reset of foreign currency valuation

    Hi FI-experts By mistake the foreign currency valuation program was executed. Does anbody know if there is a program that can reset the foreign currency run? Or is there a manual work around? Any help is appreciated. Best regards, Marco

  • Is there a limit to sharing folios?

    As the subject states, is there a limit to the number of people to share your folio with? To demo an app to different users. And this without having a professional or enterprise account yet. Thanks for the info!