Question about inserting Sysdate (SQL)

Hi all,
I got a question about records insert when one of the fields is sysdate.
I have to store several records representing a log, generated by the execution of a database package.
Inside my package I wrote an internal procedure devoted to insert a record in my log table for each processing step I wanted to trace (I call this proc each time I want to record a certain step of my package).
My log table structure is: PREC_LOGS(log_date DATE, log_message VARCHAR2(1000)), no constraints at all.
Database ver. 8.1.7.1.0 - Production for VMS O.S.
The 'problem' occurs when several records have the same sysdate (DD-MM-YYYY HH24:MI:SS). In this case, if I select log_date,log_message ... order by log_date, the list of records I get respects the sort condition, but when several records have the same sysdate (DD-MM-YYYY HH24:MI:SS), it doesn't respect the order of the steps theoretically inserted by the internal proc.
Resault
25-07-2002 11:10:20 ........ (date changed)
25-07-2002 11:10:22 Loading data for order nr. 82364 (step 3)
25-07-2002 11:10:22 Verifying order nr. 82364 (step 2)
25-07-2002 11:10:22 Procedure started for order nr. 82364 (step 1)
25-07-2002 11:10:22 Updating conditions for order nr. 82364 (step 4)
25-07-2002 11:10:22 Procedure accomplished for order nr. 82364 (step 6)
25-07-2002 11:10:22 Commit changes for order nr. 82364 (step 5)
25-07-2002 11:10:24 ........ (date changed)
Please ask for more detail if someone is interested in replying...I realize it's not a very clear explanation of my issue.
Thanks, Marco

Hi
Add a field to the table that is that uses a sequence
PREC_LOGS(log_id NUMBER(30),log_date DATE, log_message VARCHAR2(1000))
Create a database sequence
The insert statement now becomes something like
INSERT INTO PREC_LOCS(log_id, log_date, log_message)
VALUES (sequence_name.NEXTVAL, SYSDATE, 'Some message');
Then order by the log_id when you do your select.
Daniel

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

  • Question about insert date value from xml file

    I want insert value into table from xml file. Every time I inserted value of date type into the table, I got the unpasable error message as following:
    oracle.xml.sql.OracleXMLSQLException: Exception 'java.text.ParseException:Unpars
    eable date: "2000-04-19 00:00:00.0"' encountered during processing ROW element
    Thanks for anyone that can fix my problem or give me any suggestion.
    email: [email protected]

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by matmnwx:
    I want insert value into table from xml file. Every time I inserted value of date type into the table, I got the unpasable error message as following:
    oracle.xml.sql.OracleXMLSQLException: Exception 'java.text.ParseException:Unpars
    eable date: "2000-04-19 00:00:00.0"' encountered during processing ROW element
    Thanks for anyone that can fix my problem or give me any suggestion.
    email: [email protected]<HR></BLOCKQUOTE>
    Use:
    OracleXMLSave sav = new OracleXMLSave(conn,tabName);
    sav.setDateFormat(<hier the date format in the XML-File>);

  • Quick Question about Transposing/Crosstab SQL or PL/SQL query

    Hi All,
    Looking for how to transpose rows into column in SQL and/or PLSQL
    I've got thousands of rows in the format
    phone_no Code
    4161231234 A
    4161231234 B
    4161231234 C
    6471231234 A
    6471231234 B
    6471231234 C
    need to transpose this to
    phone_no Code_1 Code_2 Code_3
    4161231234 A B C
    6471231234 A B C
    Think max number of codes for phone_no is something like 10.
    Would appreciate if anybody gave guidance or direction.
    Cheers,

    Again Posted on another theard
    Sorry wanted to add 1 amendment as well in terms of Question 2)
    First Question 1)
    phone_no Code
    4161231234 A
    4161231234 B
    6471231234 A
    6471231234 C
    6471231234 D
    need to transpose this to
    phone_no A B C D
    4161231234 Y Y N N
    6471231234 Y N Y Y
    New Records such as
    6471231234 E would be appending later therefore the max number of codes for phone_no is dynamic
    Question 2)
    I also need the ability of the above table to add values of a third colum into the cross tab
    phone_no Code No_of_codes
    4161231234 A 2
    4161231234 B 1
    6471231234 A 3
    6471231234 C 1
    6471231234 D 5
    Transposes to
    phone_no A B C D
    4161231234 2 1 0 0
    6471231234 3 0 1 5
    and again
    New Records such as
    6471231234 E 7 would be appending later therefore the max number of codes for phone_no is dynamic
    Thanks for any help!!

  • Question about using pl/sql to mark records in a table

    I have a table where I have stored college course's details,
    the pertinent for this questions are the fields:
    course_number,
    alt_id1,
    alt_id2,
    cross_relation,
    What I need to do is to identify cross-listed courses (those that have an alt_id1 not null) and set the first one found to be parent in the cross_relation column, then read alt_id1 and alt_id2 and set them as children in the cross_relation column.
    example: what I have (these are in no particular order)
    course_number alt_id1 alt_id2 cross_relation
    en101 | mu101 | hs101 |
    mu101 | en101 | hs101 |
    hs101 | en101 | mu101 |
    what I want: Finds cross listed set it as P for parent and then finds its children an marks them as its children C.
    course_number | alt_id1 | alt_id2 | cross_relation
    en101 | mu101 | hs101 | P
    mu101 | en101 | hs101 | C
    hs101 | en101 | mu101 | C
    I have tried different things with different results but not the one desired,
    Please, I just need some idea on how to accomplish this.
    Thank you

    Sniff... sniff... sure smells like homework to me.
    You're likely looking for a hierachical SQL to determine the parent-child hierachy.
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns001.htm#i1009313

  • A question about insert?

    if the two applications want to insert the same data into database at the same time? but I only expect one application execute successful.
    how do I prevent insert the same data into database?

    if the two applications want to insert the same data
    into database at the same time? but I only expect one
    application execute successful.
    how do I prevent insert the same data into database?This is not an advanced language topic and the language is
    barely English, but allright. Here goes;
    To prevent the insertion of equivalent data into the same
    database you should find out about your database's transaction
    mechanisme (if it has one). If it doesn't you should look
    into mutual exclusion points in your client code.
    What I mean is, that you want to examine before you insert,
    and do this inside a protected timewindow. This can be achieved
    inside your database with the use of transactions, or it can
    be achieved inside your client code (if you're the only client
    to that database and both calls live inside the same JVM)
    by synchronization.
    in pseudo code:
    static Object mutex = new Object();
    synchronized (mutex) {
      Object[] result;
      result = sqlselect("select * from table where foo=bar;");
      if (result.length == 0) {
        sqlinsert("insert into table (foo="bar");");
    }

  • Who can help me?I have a question about JDBC with SQL Server 2000.

    import java.sql.*;
    import java.util.*;
    public class sqltest{
    static public void main(String args[]){
    try{
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    }catch(Exception e){
    e.printStackTrace();
    return;
    try{
    Connection conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://CE800:1181;UseDatabaseName=supermarket;user=sa;Password=");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select * from customers");
    while(rs.next()){
    System.out.println(rs.getString("username"));
    conn.close();
    }catch(Exception e){
    e.printStackTrace();
    return;
    when I run it,error occured:
    D:\MyJava\sql>java sqltest
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'customers'.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
    at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.executeQuery(Unknown Source)
    at sqltest.main(sqltest.java:15)
    Please help me,thanks a lot!

    Your code seems ok, you probably end up in another Database than you expect.
    Not sure about the the UseDatabaseName=supermarket clause in your connection string.
    You can confirm that get a connection to another database by changing your query to:
    SELECT * FROM supermarket.dbo.customers
    if this works you probably get a connection to master and should look closer at the UseDatabaseName=supermarket clause.
    You did try to run the query in the Query Analyzer i take it?
    Rgds

  • Question about parameters and SQL

    hi all! I have a prob and I have no idea how to solve it.
    Since now I have being consulting my tables and using only columns from those tables. the thing is that now I need to combine different tables and get some results. This is easy in SQL by selecting the attributes from the tables that you are interested with something like:
    public ResultSet busquedaCitas2(String fecha_cita)
        throws SQLException
               cdr = sentenciaSQL.executeQuery(
                "SELECT pacient.name, citas.date  " +        
                "FROM citas,pacient " +
                "WHERE citas.date like " + "'" + fecha_cita + "'");
             return cdr;
        }NOW my problem is that when I get the result back I do using a bean and a hashtable
    ResultSet cdr = bd3.busquedaCitas2(fecha);
            int id = 0;
            while (cdr.next())
             id = cdr.getInt("idCita");
                t = new BeanDatosCitas(
                id,                             // Nos servir� como identificador en la tabla HashMa
                cdr.getString("Fecha"),
                cdr.getString("Hora"),
                cdr.getString("Protocolo"),
                cdr.getString("DNI"),
                cdr.getString("Opcion"),
                cdr.getString("Observacion"),
                cdr.getString("Horaentrada")
                m.put(new Integer(id), t);
            }But this will only allow me to get the columns from a table when I need to take several columns from several tables.
    I need to get the name form the pacient that its in another table aswell some other data in other tables.
    Any ideas ? thanks!

    That cant be the solution since I have my constructor like this:
    public class BeanDatosCitas implements Comparator {
      private int id_Citas;
      private String fecha_Citas;
      private String hora_Citas;
      private String protocolo_Citas;
      private String DNI_Citas;
      private String opcion_Citas;
      private String observacion_Citas;
      private String horaent_Citas;
        /** Creates a new instance of BeanDatosCitas */
        public BeanDatosCitas() {}
        public BeanDatosCitas(int id, String fecha, String hora,String protocolo,String DNI,String opcion,String observacion,String horaent)
        id_Citas = id;
        fecha_Citas = new String(fecha);
        hora_Citas = new String(hora);
        protocolo_Citas= new String(protocolo);
        DNI_Citas= new String(DNI);
        opcion_Citas=new String(opcion);
        observacion_Citas=new String(observacion);
        horaent_Citas=new String(horaent);
        }

  • Quick Question about Transposing/Crosstab SQL or PL/SQL query Version II

    Hi All,
    2nd time I'm asking this but a little different
    Looking for how to transpose rows into column in SQL and/or PLSQL but use the transpose into column headings.
    I've got thousands of rows in the format
    phone_no Code
    4161231234 A
    4161231234 B
    6471231234 A
    6471231234 C
    6471231234 D
    need to transpose this to
    phone_no A B C D
    4161231234 Y Y N N
    6471231234 Y N Y Y
    New Records such as
    6471231234 E would be appending later therefore the max number of codes for phone_no is dynamic
    Would appreciate if anybody gave guidance or direction.
    Cheers,

    Hi,
    If the number of columns is unknown, but within a known bound, then you can do something like this:
    WITH     got_jnum    AS
         SELECT       deptno
         ,       job
         ,       sal
         ,       DENSE_RANK () OVER (ORDER BY job)     AS jnum
         FROM       scott.emp
    SELECT       deptno
    ,       TO_CHAR (SUM (CASE WHEN jnum = 1 THEN sal END), '99999999')     AS job_1
    ,       TO_CHAR (SUM (CASE WHEN jnum = 2 THEN sal END), '99999999')     AS job_2
    ,       TO_CHAR (SUM (CASE WHEN jnum = 3 THEN sal END), '99999999')     AS job_3
    ,       TO_CHAR (SUM (CASE WHEN jnum = 4 THEN sal END), '99999999')     AS job_4
    FROM       got_jnum
    GROUP BY  deptno
        UNION ALL
    SELECT       NULL                                   AS deptno
    ,       MIN (CASE WHEN jnum = 1 THEN LPAD (job, 9) END)     AS job_1
    ,       MIN (CASE WHEN jnum = 2 THEN LPAD (job, 9) END)     AS job_2
    ,       MIN (CASE WHEN jnum = 3 THEN LPAD (job, 9) END)     AS job_3
    ,       MIN (CASE WHEN jnum = 4 THEN LPAD (job, 9) END)     AS job_4
    FROM       got_jnum
    ORDER BY  deptno     NULLS FIRST
    ;Output:
    .    DEPTNO JOB_1     JOB_2     JOB_3     JOB_4
                 ANALYST     CLERK   MANAGER PRESIDENT
            10                1300      2450      5000
            20      6000      1900      2975
            30                 950      2850See [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=4051662&#4051662] for context.
    As mentioned there, String Aggregation is another possibility.
    If the number of columns is completely unknown, then I see your options as:
    (1) String Aggregation
    (2) Dynamic SQL
    (3) Wrapping (See [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3527823])

  • Question about creating an SQL search

    Hi, In the app I am developing the user can search one of my database tables by one or more of three fields. If a field is left blank is there anyway to set up an SQL statement so that a dummy search criteria is entered for that field? That probably isn't very clear, here example:
    I have 3 fields: ID, Surname and Forname. Currently in my app code I am checking whether fields are empty, or if two are empty and one isn't etc, before constructing the appropriate SQL statement with the fields that are not empty. What I am after is something like this, so I can just have one SQL statement that can handle one or more of the fields being empty, for example if the ID and Forname search fields have something in them, but the Surname field is empty:
    Select * from employees where ID = 2 AND Surname = 'ANY' AND Forname = 'Smith'
    Thanks

    Ushitaki,
    Yes, that's a good point you are raising here. The NVL always evaluates both expressions and results in a full table scan.
    However, your variant might be "evil" as well since you are also using one query to handle two situations: one where you'd want a index scan because a value was given and one where you'd want a full table scan because the user did not provide a value.
    So if performance is a problem here, the best option probably is to dynamically construct the query, using binds, but have several different queries populating the library cache, each with its own optimal plan.
    Regards,
    Rob.
    Here are some results from my test:
    SQL> create table mytable
      2  as
      3  select l id, '*********' description from (select level l from dual connect by level <= 10000)
      4  /
    Tabel is aangemaakt.
    SQL> create index i1 on mytable(id)
      2  /
    Index is aangemaakt.
    SQL> exec dbms_stats.gather_table_stats(user,'MYTABLE',cascade=>true)
    PL/SQL-procedure is geslaagd.
    SQL> alter session set sql_trace true
      2  /
    Sessie is gewijzigd.
    SQL> declare
      2    cursor c1(b_id number) is select id,description from mytable where id = nvl(b_id,id);
      3    cursor c2(b_id number) is select id,description from mytable where id = b_id or b_id is null;
      4  begin
      5    for r in c1(1) loop null; end loop;
      6    for r in c1(null) loop null; end loop;
      7    for r in c2(1) loop null; end loop;
      8    for r in c2(null) loop null; end loop;
      9  end;
    10  /
    PL/SQL-procedure is geslaagd.
    SQL> disconnectAnd tkprof shows:
    SELECT ID,DESCRIPTION
    FROM
    MYTABLE WHERE ID = NVL(:B1 ,ID)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      2      0.09       0.14          0          0          0           0
    Fetch    10003      0.32       0.34          0      10007          0       10001
    total    10006      0.41       0.48          0      10007          0       10001
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 9833     (recursive depth: 1)
    Rows     Row Source Operation
      10001  CONCATENATION
      10000   FILTER
      10000    TABLE ACCESS FULL MYTABLE
          1   FILTER
          1    TABLE ACCESS BY INDEX ROWID MYTABLE
          1     INDEX RANGE SCAN I1 (object id 2674783)
    SELECT ID,DESCRIPTION
    FROM
    MYTABLE WHERE ID = :B1 OR :B1 IS NULL
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      2      0.24       0.33          0          0          0           0
    Fetch    10003      0.22       0.31          0      10034          0       10001
    total    10006      0.46       0.65          0      10034          0       10001
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 9833     (recursive depth: 1)
    Rows     Row Source Operation
      10001  TABLE ACCESS FULL MYTABLE
    ********************************************************************************

  • Question about moving a SQL profile to a different database

    All,
    I know in 11g I can move SQL baselines to another host. Does anyone know if I can more just a single SQL Profile and how that is accomplished. I'm not seeing a PL/SQL package do to this but I may be missing it. Also, no hits on Metalink or Ask Tom on how to do this. I have this vague memory that it is possible but I'll be dammed if I can figure out how to do it.
    thanks in advance
    J Sebastian

    Just to inform
    http://blog.flimatech.com/2010/06/08/how-does-one-move-sql-profiles-from-one-instance-to-another/
    Have very good example how to move SQL profile

  • Ole2 question about inserting document object in Word

    I thought I had it figured out but it doesn't seem to work. From a Oracle Forms 6i application, I want to insert an object(a file) in a word document as an icon.
    The vb code generated when I record the macro of inserting an object as an icon is:
    Selection.InlineShapes.AddOLEObject ClassType:="Word.Document.8", FileName _
    :="string defining the location of the file object", LinkToFile:=False _
    , DisplayAsIcon:=True, IconFileName:= _
    "C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0050048383C9}\wordicon.exe" _
    , IconIndex:=1, IconLabel:= _
    "string defining the location of the file object"
    Using this I wrote the following code: ( I am leaving out the declaration of the ole2.obj_type and other variables)
    args := ole2.create_arglist;
    ole2.add_arg (args, 'string defining the location of the file object');
    hinlineshapes :=
    ole2.get_obj_property (hselection, 'InlineShapes');
    ole2.invoke (hinlineshapes
    ,'AddOLEObject'
    ,args
    ole2.destroy_arglist (args);
    holeformat := ole2.get_obj_property (hinlineshapes, 'OLEFormat');
    ole2.set_property (holeformat
    ,'ClassType'
    ,'Word.Document.8'
    ole2.set_property (holeformat
    ,'DisplayAsIcon'
    ,TRUE
    ole2.set_property (holeformat
    ,'IconLabel'
    ,'string defining the location of the file object'
    When I run the code I get the following message from MS Word:
    " This object was created in 'string defining the location of the file object'.
    This application is not available to open this object.
    Make sure the application is properly installed and that it has not deleted, moved or renamed."
    Can someone please help? Thanks in advance.

    Second, when it inserts the date, it makes it an "update automatically" date that updates to the current time every time I open the document
    Sure, that's because you specifically tell it to. Your script inserts a 'new field' which is analogous to Word's dynamic text objects (date, time, page number, etc.)
    Instead, what you want to do is insert an actual string of characters - sure, to you and I that string of characters might look like a date and time, but to Word it's nothing more than a series of characters.
    For that we can fall back on AppleScript's date features, specifically current date, like:
    tell application "Microsoft Word"
      tell selection
        type text text "Left message " & (current date as text)
      end tell
    end tell
    Note that current date as text returns a rather verbose form of the date. If that's too much for you there are alternate options, such as:
    short date string of (current date) & space & time string of (current date)
    which will look more like: "6/10/10 3:26:50 PM"
    But there is also a myriad of other ways (with seconds, without seconds, 12/24 hr, etc.) depending on what you want.
    Third, if possible, I would also like it to be in italics.
    I'll have to look at that one, unless someone else beats me to it.

  • Some questions about mssqlsystemresource in sql server 2012.

    1,What's the relationship of Location for database Master and mssqlsystemresource  in 2012? based on the following technet article it states
    " If you move the master database, you must also move the Resource database to the
    same location."
    https://msdn.microsoft.com/en-us/library/ms187837(v=sql.110).aspx
    So I moved the master database , however I found if I move the mssqlsystemresource  to the same path as the Master database, then the sqlserver can't start successfully, if keeping the path for mssqlsystemresource to the original path,
    it can start successfully, so what's the means " If you move the master database, you must also move the Resource database to the same location."       
    2,If I want to move the path for mssqlsystemresource  to new path, and make sure the sqlserver can start successfully, how should I do? It doesn't mentioned in the following article.
    https://msdn.microsoft.com/en-us/library/ms190940(v=sql.110).aspx
    Please click the Mark as Answer button if a post solves your problem!

    You did the testing in 2014 or 2012?
    In 2012 (Microsoft SQL Server 2012 - 11.0.5058.0 (X64) , if I move it from "MSSQL11.MSSQLSERVER\MSSQL\Binn" to "Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA" in which contains the Master database ,it would failed and stated"FileMgr::StartLogFiles:
    Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\mssqlsystemresource.ldf'"
    As I already told I id it on 2014 but it would hardly matter. Error message says that it cannot locate the file. Did you properly ran alter database command to move files. Do you want m to create a step by step to show it to you, I can do it but it would take
    a bit of time.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP
    Hi
    Shanky,
    thank you so much, may I know how to alter the path for mssqlsystemresource ? I tried to run the following, but failed "Database 'mssqlsystemresource' does not exist. Make sure that the
    name is entered correctly."
     ALTER DATABASE mssqlsystemresource MODIFY FILE ( NAME = mssqlsystemresourcedata, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\mssqlsystemresource.MDF' );
    Please click the Mark as Answer button if a post solves your problem!

  • Question about sql batch process in java app

    hi all
    i have few questions about using batch process in the java.sql package. the addBatch method can take sql statements like inserts or updates. can we use a mixture of insert and update then? can we use prepared statement for this? it's just for performance consideration. thanks in advance.

    hi all
    i have few questions about using batch process in the
    java.sql package. the addBatch method can take sql
    statements like inserts or updates. addBatch() is a method that has no parameters. It doesn't 'add' sql statements.
    can we use a
    mixture of insert and update then? can we use
    prepared statement for this? it's just for
    performance consideration. thanks in advance.The point of batching is that you take something that is invariant and then 'add' a variant part.
    Thus a single insert has an invariant part (the table and specific columns) and a variant part (the data for each row by column.)
    You can use anything that is valid SQL (for jdbc, driver, database) and use it presuming your database allows that particular usage in batching. But that does require some regular pattern - it won't work if your usage is random. Nor will it work if some statements need to be executed only some of the time. Finally also note that transaction processing will often require smaller chunks - you can't insert a million rows in one batch.

  • A question about the impact of SQL*PLUS SERVEROUTPUT option on v$sql

    Hello everybody,
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0  Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>
    OS : Fedora Core 17 (X86_64) Kernel 3.6.6-1.fc17.x86_64I would like to ask a question about the SQL*Plus SET SERVEROUTPUT ON/OFF option and its impact on queries on views such as v$sql and v$session. Here is the problem
    Actually I define three variables in SQL*Plus in order to store sid, serial# and prev_sql_id columns from v$session in order to be able to use them later, several times in different other queries, while I'm still working in the current session.
    So, here is how I proceed
    SET SERVEROUTPUT ON;  -- I often activate this option as the first line of almost all of my SQL-PL/SQL script files
    SET SQLBLANKLINES ON;
    VARIABLE mysid NUMBER
    VARIABLE myserial# NUMBER;
    VARIABLE saved_sql_id VARCHAR2(13);
    -- So first I store sid and serial# for the current session
    BEGIN
        SELECT sid, serial# INTO :mysid, :myserial#
        FROM v$session
        WHERE audsid = SYS_CONTEXT('UserEnv', 'SessionId');
    END;
    PL/SQL procedure successfully completed.
    -- Just check to see the result
    SQL> SELECT :mysid, :myserial# FROM DUAL;
        :MYSID :MYSERIAL#
           129   1067
    SQL> Now, let's say that I want to run the following query as the last SQL statement run within my current session
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;According to Oracle® Database Reference 11g Release 2 (11.2) description for v$session
    http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3016.htm#REFRN30223]
    the column prev_sql_id includes the sql_id of the last sql statement executed for the given sid and serial# which in the case of my example, it will be the above mentioned SELECT query on the employees table. As a result, right after the SELECT statement on the employees table I run the following
    BEGIN
        SELECT prev_sql_id INTO :saved_sql_id
        FROM v$session
        WHERE sid = :mysid AND serial# = :myserial#;
    END;
    PL/SQL procedure successfully completed.
    SQL> SELECT :saved_sql_id FROM DUAL;
    :SAVED_SQL_ID
    9babjv8yq8ru3
    SQL> Having the value of sql_id, I'm supposed to find all information about cursor(s) for my SELECT statement and also its sql_text value in v$sql. Yet here is what I get when I query v$sql upon the stored sql_id
    SELECT child_number, sql_id, sql_text
    FROM v$sql
    WHERE sql_id = :saved_sql_id;
    CHILD_NUMBER   SQL_ID          SQL_TEXT
    0              9babjv8yq8ru3    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;Therefore instead of
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;for the value of sql_text I get the following value
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES);Which is not of course what I was expecting to find in v$sql for the given sql_id.
    After a bit googling I found the following thread on the OTN forum where it had been suggested (well I think maybe not exactly for the same problem) to turn off SERVEROUTPUT.
    Problem with dbms_xplan.display_cursor
    This was precisely what I did
    SET SERVEROUTPUT OFFafter that I repeated the whole procedure and this time everything worked pretty well as expected. I checked SQL*Plus documentation for SERVEROUTPUT
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Could anyone kindly make some clarification?
    thanks in advance,
    Regards,
    Dariyoosh

    >
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Hi Dariyoosh,
    SET SERVEROUTPUT ON has the effect of executing dbms_output.get_lines after each and every statement. Not only related to system view.
    Here below what Tom Kyte is explaining in this page:
    Now, sqlplus sees this functionality and says "hey, would not it be nice for me to dump this buffer to screen for the user?". So, they added the SQLPlus command "set serveroutput on" which does two things
    1) it tells SQLPLUS you would like it <b>to execute dbms_output.get_lines after each and every statement</b>. You would like it to do this network rounding after each call. You would like this extra overhead to take place (think of an install script with hundreds/thousands of statements to be executed -- perhaps, just perhaps you don't want this extra call after every call)
    2) SQLPLUS automatically calls the dbms_output API "enable" to turn on the buffering that happens in the package.Regards.
    Al

Maybe you are looking for

  • Receiver file adapter not responding

    Hi guys, I have 2 interfaces in XI development system that make use of receiver file adapter in order to receive some .txt files. Although these communication channels used to work until yesterday, for some strange reason they stopped functioning, bu

  • Issue with hostname "localhost" and general CR connectivity issue

    Hello, we installed SAP BOE with the integrated Tomcat 6. We used a Web Tier installation on the same host, but in different paths. Tomcat was installed under /usr/sap/tomcat/sap_bobj/tomcat and the SAP BOE package under /usr/sap/XXX/sap-bobj/enterpr

  • Audible Books not showing in playlist

    I have my Audible books synched up in my iPad. When I go to the iPod application and select "Audiobooks" it shows a book icon that says "Audible (5 Books)" but when I click on this icon the list appears empty. The only way I can play the books is goi

  • Ink Cartridges not near what it should

    My son purchased me a hp5520 last year for my birthday, I have purchased ink at least 4 times in a year. I do not print that much and dont understand what the problem is. The last time I bought ink it was gone in a month. I just bought ink today and

  • Customize XSLT List View Webpart Styling

    Hello, everyone. I think I know the answer to this, but I'm at wits end so I figured I'd turn to the forums (first time). I'm a SP Power User with some minimal coding experience. I know CSS, HTML, some JS, some JQuery. My question, however, involves