Need to hcheck.sql

Hello

Am in need of file hcheck.sql looking for data dictionary discripencies...

If anyone has it please send to the [email protected]

Connect to Oracle support and look for the following document where you can download the correct Hcontrolez file:

'hcheck.sql' script to check the known issues with Oracle8i, Oracle9i, Oracle10g and Oracle 11 g (Doc ID 136697.1)

HTH - Mark D Powell.

Tags: Database

Similar Questions

  • I use Windows Vista and that you need to download SQL Server 2005 Express Service Pack 4. I get an error code of 64 C. Please tell me what to do?

    I use Windows Vista and that you need to download SQL Server 2005 Express Service Pack 4. I get an error code 64 C help, please.

    Hello

    I suggest you to try the steps below and check if it helps.

    Method 1: Try to reset components to update Windows from the following link, which would help you to install the updates of windows. http://support.Microsoft.com/kb/971058

    Method 2: If the problem persists, then try to set up your computer in a clean boot state, and check to see if the same problem happens.

    By setting your boot system minimum state helps determine if third-party applications or startup items are causing the problem.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or Windows 7:
    http://support.Microsoft.com/kb/929135

    Note: After the boot minimum troubleshooting step, follow step 7 in the link provided to return the computer to a Normal startup mode.

    Method 3: Also try to install the updates manually from the link below.

    http://www.Microsoft.com/download/en/details.aspx?displaylang=en&ID=184

    You can also consult the following link for more information:

    Troubleshoot problems with installing updates.

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-installing-updates

    Hope this information is useful.

  • Logic needed in pl/sql

    Hello

    I need help to implement this logic. in pl/sql.

    My logic is like this:

    I have a column in a table of data with some historical values (could be 3... It may be 10).

    Of these, I have to take 5 values every time there is a change in the values under that column... and fill 5 fixed a target table columns.

    For example:

    Historical_column_value (in some order):

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

    A

    B

    B

    C

    D

    D

    D

    B

    F

    G

    .. and so on...

    Target output column value:

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

    Col1 Col2 Col3 Col4 Col5

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

    A             B          C            D        B

    Here's so historical data have no limits... but it's only 5 columns in the target table.

    (Note: here I can not use the "distinct" clause in sql.)

    Therefore, logic is necessary to implement this.

    Thank you

    Bogoss

    Just replace the where condition

    WHERE LAG1! = HISTORICAL_COLUMN_VALUE

    with thiis

    WHERE nvl(LAG1,0)! = nvl(HISTORICAL_COLUMN_VALUE,0)

  • Need help with Sql Tunning

    Under Update taking 2 h complete 3000 sets.

    UPDATE ARR_TRANSACTIONS ARR

    SET = NUMBER99

    (SELECT ARR_1.NUMBER99

    OF ARR_TRANSACTIONS ARR_1, ARR_HEADER BH

    WHERE ARR_1.ARR_ID = BH. ARR_ID

    AND BH. FLAG = "Y".

    AND ARR_1.LINE_ID = ARR. ORIG_INV_LINE_ID

    AND ARR_1.NUMBER9 IS NOT NULL

    AND ROWNUM = 1)

    WHERE ARR BATCH_ID = 26219

    AND ARR. NUMBER99 IS NULL

    I added more some condition where to reduce cost and its working fine. But I need to rise more than performance on SQL.

    Please help with SQL.

    I do not see the number of 3000 lines in the plan - so I guess that the optimizer does not compute with the correct numbers. Could generate the plan with dbms_xplan.display_cursor? This could tell us something about filter predicates and access.

    In the given situation, I would check:

    • is the access to the index in step 1 (filtered by the relevant conditions: this could be BATCH_ID = 26219) return actually 248 entries (or something similar)?
    • Access table in step 2 returning 204 lines (or something similar) after applying the filters given? If the number of lines is much bigger then a Nested Loops is perhaps not a good idea.

    To make this much simpler check, you could create a plan with statistics of content (RowSource) given that the plan containing the real and the number of estimated rows.

    If the estimated cardinalities are not plausible the next question would be if the statistics are strong and up to date.

  • Need help with sql query

    Dear all,

    I have a sql like query below

    SELECT min (G.TRANSACTION_DATE), D.REQUEST_NUMBER

    MTL_TXN_REQUEST_HEADERS D,.

    MTL_TXN_REQUEST_LINES, E.

    MTL_MATERIAL_TRANSACTIONS G,.

    Mtl_Transaction_Types I have

    WHERE D.HEADER_ID = E.HEADER_ID

    AND G.TRANSACTION_TYPE_ID = I.TRANSACTION_TYPE_ID

    AND Upper (I.Transaction_Type_Name) = Upper ('TEC outcome')

    AND E.LINE_ID = G.MOVE_ORDER_LINE_ID

    AND D.MOVE_ORDER_TYPE = 5

    TO_DATE (G.TRANSACTION_DATE) BETWEEN TO_DATE('01-JAN-2014') AND TO_DATE('31-DEC-2014')

    D.REQUEST_NUMBER GROUP

    I need to get the first number of the application and finally ask for number based on the date of the transaction, how can I get the number of name application and based on the date of the transaction for the same query, please help me.

    above query is back under results

    results.jpg

    If the query should return a line with the number of application like 2383 based on minimum transaction date and another column based on the maximum transaction date, please help me.

    so in the example above, it must return

    FIRST REQUEST NUMBER LAST NUMBER

    2383                                      1886

    Thank you

    select min(request_number) keep(dense_rank first order by transaction_date asc ) request_number_min
         , min(request_number) keep(dense_rank first order by transaction_date desc) request_number_max
      from (
            select min(g.transaction_date) transaction_date
                 , d.request_number
              from mtl_txn_request_headers d
                 , mtl_txn_request_lines e
                 , mtl_material_transactions g
                 , mtl_transaction_types i
             where d.header_id                    = e.header_id
               and g.transaction_type_id          = i.transaction_type_id
               and upper(i.transaction_type_name) = upper('WIP Issue')
               and e.line_id                      = g.move_order_line_id
               and d.move_order_type              = 5
               and to_date(g.transaction_date) between to_date('01-jan-2014') and to_date('31-dec-2014')
             group
                by d.request_number
           )
    
  • Need help with sql query performance

    Dear all,

    I have a sql like query below, I need to give the following query please help me identify which statement I should tune to have better performanece.

    Select rownum LINE_NUM,

    A.LINE_ID,

    TO_CHAR (A.INVITMID),

    TO_NUMBER (A.PICKQTY),

    UNLOADINGPNT NULL,

    RRNUM NULL,

    WORKORDNUM NULL,

    WORKORDDESC NULL,

    A.PONUM,

    DTR_DUMB NULL,

    A.DESCRIPTION,

    FROM_SUB NULL,

    TO_SUB NULL,

    NO SOURCE,

    ASSET_NUMBER NULL,

    A.RECEIPTNUM,

    MOVEORD NULL,

    FROM_LOC NULL,

    TO_LOC NULL,

    MSD_NUM NULL,

    CONTAIN_LINE NULL,

    A.UOM,

    A.PO_RELEASE

    de)

    Select headerid Po.Po_Header_Id,

    rcv1. Po_Line_Id LINE_ID,

    rcv1.item_id INVITMID,

    (NVL(Rcv1.Transact_Qty,0)-NVL(rcv2.transact_qty,0)) PICKQTY,

    Po.Segment1 PONUM,

    Rcv1.Receipt_Num RECEIPTNUM,

    Rcv1.Item_Desc DESCRIPTION,

    Rcv1.Transact_Uom GLU,

    Rcv1.Po_release

    Po_Headers_All in.,.

    (Select rcv3. Po_Header_Id, RCV3.receipt_num, rcv3. Po_Line_Id, rcv3. Destination_Type_Code, rcv3. Item_Id, rcv3. Item_Desc, rcv3. Transact_Uom, SUM (rcv3. Transact_Qty) Transact_Qty, rcv3. PO_RELEASE OF)

    SELECT A.Po_Header_Id,

    C.RECEIPT_NUM receipt_num,

    A.Po_Line_Id,

    A.Destination_Type_Code,

    B.Item_Id,

    B.item_description Item_Desc,

    A.UNIT_OF_MEASURE Transact_Uom,

    A.QUANTITY Transact_Qty,

    D.RELEASE_NUM PO_RELEASE

    OF RCV_TRANSACTIONS,.

    RCV_SHIPMENT_HEADERS C.

    B RCV_SHIPMENT_LINES,

    PO_RELEASES_ALL D

    WHERE C.SHIPMENT_HEADER_ID = A.SHIPMENT_HEADER_ID

    AND B.SHIPMENT_LINE_ID = A.SHIPMENT_LINE_ID

    AND UPPER (A.Transaction_Type) = "to DELIVER".

    AND higher (A.Destination_Type_Code) = "EXPENSES".

    AND D.PO_RELEASE_ID = A.PO_RELEASE_ID

    UNION ALL

    SELECT A.Po_Header_Id,

    C.RECEIPT_NUM receipt_num,

    A.Po_Line_Id,

    A.Destination_Type_Code,

    B.Item_Id,

    B.item_description Item_Desc,

    A.UNIT_OF_MEASURE Transact_Uom,

    A.QUANTITY Transact_Qty,

    D.RELEASE_NUM PO_RELEASE

    OF RCV_TRANSACTIONS,.

    RCV_SHIPMENT_HEADERS C.

    B RCV_SHIPMENT_LINES,

    PO_RELEASES_ALL D

    WHERE C.SHIPMENT_HEADER_ID = A.SHIPMENT_HEADER_ID

    AND B.SHIPMENT_LINE_ID = A.SHIPMENT_LINE_ID

    AND B.ITEM_ID IS NULL

    AND UPPER (A.Transaction_Type) = "to DELIVER".

    AND higher (A.Destination_Type_Code) = "WORKSHOP".

    D.PO_RELEASE_ID AND = A.PO_RELEASE_ID) rcv3

    GROUP BY rcv3. Po_Header_Id, RCV3.receipt_num, rcv3. Po_Line_Id, rcv3. Destination_Type_Code, rcv3. Item_Id, rcv3. Item_Desc, rcv3. Transact_Uom, rcv3. Rcv1 PO_RELEASE),

    (SELECT A.PO_LINE_ID,

    Sum (A.Quantity) transact_qty,

    A.PO_HEADER_ID,

    C.RECEIPT_NUM

    OF RCV_TRANSACTIONS,.

    RCV_SHIPMENT_HEADERS C.

    B RCV_SHIPMENT_LINES,

    PO_RELEASES_ALL D

    WHERE C.SHIPMENT_HEADER_ID = A.SHIPMENT_HEADER_ID

    AND B.SHIPMENT_LINE_ID = A.SHIPMENT_LINE_ID

    AND UPPER (A.Transaction_Type) = "RETURN to the RECEPTION"

    AND D.PO_RELEASE_ID = A.PO_RELEASE_ID

    A.PO_LINE_ID, A.PO_HEADER_ID, C.RECEIPT_NUM GROUP) Rcv2

    Where Po.Po_Header_Id = Rcv1.Po_Header_Id (+)

    And Rcv1.Po_Line_Id = Rcv2.Po_Line_Id (+)

    And Rcv1.Receipt_Num = Rcv2.Receipt_Num (+)

    And Rcv1.Transact_Qty <>Nvl(Rcv2.Transact_Qty,999999999)

    Group of po.po_header_id, rcv1.po_line_id, po.segment1, rcv1.receipt_num, rcv1.item_id, Rcv1.Item_Desc, rcv1. TRANSACT_UOM, rcv1. PO_RELEASE, (NVL(Rcv1.Transact_Qty,0)-NVL(RCV2.transact_qty,0))) has

    Is my version of the database: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Please find the attached PLAN to EXPLAIN.

    EXPLAINPLAN.jpg

    Thank you

    May be essentially the same join (between a, b, c and d) twice instead of three times

    sounds like it could be done with a single join (between a, b, c, and d), but you do not some columns than the columns of rcv1 rcv2

    We can work on what we can see only

    Select rownum line_num,

    rcv1.po_line_id line_id,

    TO_CHAR (rcv1.item_id) invitmid,

    NVL(rcv1.transact_qty,0) - nvl(rcv2.transact_qty,0) pickqty,

    unloadingpnt null,

    rrnum null,

    workordnum null,

    workorddesc null,

    Po. Ponum Segment1,

    dtr_dumb null,

    description of the rcv1.item_desc,

    from_sub null,

    to_sub null,

    No source,

    asset_number null,

    rcv1.receipt_num receiptnum,

    moveord null,

    from_loc null,

    to_loc null,

    msd_num null,

    contain_line null,

    Glu rcv1.transact_uom,

    rcv1.po_release

    of po_headers_all in.

    left outer join

    (select a.po_header_id,

    c.receipt_num,

    a.po_line_id,

    a.destination_type_code,

    b.item_id,

    b.item_description item_desc,

    a.unit_of_measure transact_uom,

    Sum (a.Quantity) transact_qty,

    d.release_num po_release

    from (select shipment_header_id,

    shipment_line_id,

    po_release_id,

    po_header_id,

    po_line_id,

    destination_type_code,

    unit_of_measure,

    quantity

    of rcv_transactions

    where upper (a.transaction_type) = "to DELIVER".

    and upper (a.destination_type_code) ('charge', 'WORKSHOP')

    ) a

    inner join

    rcv_shipment_lines b

    On a.shipment_line_id = b.shipment_line_id

    inner join

    c rcv_shipment_headers

    On a.shipment_header_id = c.shipment_header_id

    left outer join

    po_releases_all d

    On a.po_release_id = d.po_release_id

    where upper (a.destination_type_code) = "EXPENSES".

    or (upper (a.destination_type_code) = 'WORKSHOP'

    and b.item_id is null

    )

    A.po_header_id group,

    c.receipt_num,

    a.po_line_id,

    a.destination_type_code,

    b.item_id,

    b.item_description,

    a.unit_of_measure,

    d.release_num

    ) rcv1

    On po.po_header_id = rcv1.po_header_id

    left outer join

    (select a.po_line_id,

    Sum (a.Quantity) transact_qty,

    a.po_header_id,

    c.receipt_num

    from (select shipment_header_id,

    shipment_line_id,

    po_release_id,

    po_header_id,

    quantity

    of rcv_transactions

    where upper (a.transaction_type) = "RETURN to THE RECIPIENTS.

    ) a

    inner join

    rcv_shipment_lines b

    On a.shipment_line_id = b.shipment_line_id

    inner join

    c rcv_shipment_headers

    On a.shipment_header_id = c.shipment_header_id

    left outer join

    po_releases_all d

    On a.po_release_id = d.po_release_id

    A.po_line_id group,

    a.po_header_id,

    c.receipt_num

    ) rcv2

    On rcv1.po_line_id = rcv2.po_line_id

    and rcv1.receipt_num = rcv2.receipt_num

    where rcv1.transact_qty! = nvl(rcv2.transact_qty,999999999)

    Concerning

    Etbin

  • Need help with SQL/PL/SQL for Dates

    Hi Experts - need help with a SQL query.

    I need to insert some date fields in a table called CALENDAR_PERIOD.

    Current data in CALENDAR_PERIOD table with their data types:

    STARTPERIOD (DATE) YEAR (NUMBER) PERIOD_LABEL (Varchar2 255)

    02/11/2014 2014 2014/02/11 SUN

    03/11/2014 2014 14/03/11 MON

    04/11/2014 2014 11/04/14 MAR

    I have to increment above values up to the year 2025. I don't know how to write SQL and increment of these values.

    Ex: My next value should insert: 05/11/2015 2014 11/05/14 WED like that I need to insert data until 12 31, 2025.

    Can you please help me with PL/SQL block?

    Really appreciate your help!

    DB version:

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

    PL/SQL Release 11.2.0.3.0 - Production

    CORE Production 11.2.0.3.0

    AMT for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    Thank you
    Sandy

    Hello Sandy,

    Maybe something like

    INSERT INTO calendar_period (startperiod, year, period_label)

    SELECT DATE '' 2014-11-04 + LEVEL

    , TO_NUMBER (TO_CHAR (DATE '' 2014-11-04 + LEVEL, "YYYY"))

    , TO_CHAR (DATE '' 2014-11-04 + LEVEL, "MM/DD/YY DY")

    OF the double

    CONNECT BY LEVEL<= date="" '2025-12-314="" -="" date="">

    ;

    ((mais je ne comprends pas pourquoi nous créons une telle table "année" et "period_label" peuvent être calculé à partir de startperiod))

    Best regards

    Bruno Vroman.

  • need help with sql queries

    Dear all,

    I have a parameter like below

    11000048,11000050

    I need to convert in SQL format below, please help me

    "11000048","11000050"


    ' parameter would be so separated by commas, I need to convert in above format, if the parameter is a number say 1111111 must convert it as "1111111" in sql.


    Please help me.


    Thank you

    You can do it

    your_parameter: = "" ' | " Replace (your_parameter, ",", "",""). '"';

  • Need help on Sql Developer 4.0.0.13.30

    Hello

    I need a few suggestions if the underside of features/settings exist in the version of the sql developer said.

    When I open a new connection, a new code editor opens sometimes, sometimes it does not. It should open each time. Is there any setting for this?

    Can I get a list of all currently open windows in a corner of my window of developer sql (like its pl/sql developer tool, in the lower left corner)?

    I can cascade open windows? I can see vertical / horizontal / Float option window, but none cascading is here.

    Thank you

    If you click on the small blue arrow in the top right corner down - it will be on the same line as the list of tabs of the document - it will show you your list of open editors. Windows > Documents will also show you this.

  • Need advice on SQL report base to APEX or jasper

    Hi all

    I need some advice on how to approach the question under the requirement of report. It was me mad for almost 2 weeks now, and my time is running out.
    Here is a simplified version of the database

    Four paintings: event, Service, commitment, defendant.
    A defendant may have more than 1 commitment, but they only open at a time commitment.
    For each commitment, they will have services and events.
    These events may be just general events or related to the service.
    Here's the script for tables and sample data
    CREATE TABLE "DEFENDANT" 
       ("DEF_ID" NUMBER, 
         "FIRST_NAME" VARCHAR2(50 BYTE), 
         "LAST_NAME" VARCHAR2(50 BYTE), 
         "ACTIVE" NUMBER DEFAULT 1
       ) ;
    Insert into DEFENDANT (DEF_ID,FIRST_NAME,LAST_NAME,ACTIVE) values (1,'Joe','Bloggs',1);
    Insert into DEFENDANT (DEF_ID,FIRST_NAME,LAST_NAME,ACTIVE) values (2,'John','Doe',1);
    --------------------
     CREATE TABLE "ENGAGEMENT" 
       ("ENG_ID" NUMBER, 
         "DEF_ID" NUMBER, 
         "COURT_NAME" VARCHAR2(20 BYTE), 
         "DATE_JOINED" DATE, 
         "DATE_TERMINATED" DATE, 
         "ETHNICITY" VARCHAR2(50 BYTE), 
         "ACTIVE" VARCHAR2(20 BYTE)
       ) ;
    /
    
    Insert into ENGAGEMENT (ENG_ID,DEF_ID,COURT_NAME,DATE_JOINED,DATE_TERMINATED,ETHNICITY,ACTIVE) values (1,1,'AAA',to_date('01/09/12','DD/MM/RR'),to_date('20/09/12','DD/MM/RR'),'European','1');
    Insert into ENGAGEMENT (ENG_ID,DEF_ID,COURT_NAME,DATE_JOINED,DATE_TERMINATED,ETHNICITY,ACTIVE) values (2,2,'BBB',to_date('01/10/12','DD/MM/RR'),null,'Asian','1');
    Insert into ENGAGEMENT (ENG_ID,DEF_ID,COURT_NAME,DATE_JOINED,DATE_TERMINATED,ETHNICITY,ACTIVE) values (3,1,'AAA',to_date('22/09/12','DD/MM/RR'),null,'European','1');
    -------------------------------------------------------- 
     CREATE TABLE "EVENT" 
       ("EVENT_ID" NUMBER, 
         "ENG_ID" NUMBER, 
         "NOTES" VARCHAR2(20 BYTE), 
         "RELATED_SERVICE_ID" NUMBER, 
         "START_DATE" DATE, 
         "END_DATE" DATE, 
         "ACTIVE" NUMBER DEFAULT 1
       ) ;
    /
    --------------------------------------------------------
    Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (1,1,null,1,to_date('01/09/12','DD/MM/RR'),to_date('02/09/12','DD/MM/RR'),1);
    Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (2,1,null,1,to_date('23/09/12','DD/MM/RR'),null,1);
    Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (3,1,null,2,to_date('15/10/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),1);
    Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (4,2,null,null,to_date('02/10/12','DD/MM/RR'),null,1);
    Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (5,2,null,2,to_date('03/10/12','DD/MM/RR'),null,1);
    Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (6,3,null,null,to_date('22/09/12','DD/MM/RR'),to_date('23/09/12','DD/MM/RR'),1);
    Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (7,3,null,4,to_date('23/09/12','DD/MM/RR'),null,1);
    Insert into EVENT (EVENT_ID,ENG_ID,NOTES,RELATED_SERVICE_ID,START_DATE,END_DATE,ACTIVE) values (8,2,null,null,to_date('12/10/12','DD/MM/RR'),null,1);
    --------------------------------------------------------
     CREATE TABLE "SERVICE" 
       (     "SERVICE_ID" NUMBER, 
         "ENG_ID" NUMBER, 
         "DESCRIPTION" VARCHAR2(200 BYTE), 
         "DATE_STARTED" DATE, 
         "DATE_TERMINATED" DATE, 
         "ACTIVE" NUMBER DEFAULT 1
       );
    /
    
    Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (1,1,'Counselling',to_date('15/09/12','DD/MM/RR'),to_date('18/09/12','DD/MM/RR'),1);
    Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (2,1,'Housing',to_date('20/09/12','DD/MM/RR'),null,1);
    Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (3,2,'Treatment',to_date('01/10/12','DD/MM/RR'),to_date('15/10/12','DD/MM/RR'),1);
    Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (4,3,'Housing',null,null,1);
    Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (5,1,'Other',to_date('05/10/12','DD/MM/RR'),null,0);
    Insert into SERVICE (SERVICE_ID,ENG_ID,DESCRIPTION,DATE_STARTED,DATE_TERMINATED,ACTIVE) values (6,2,'Treatment',to_date('16/10/12','DD/MM/RR'),null,1);
    ****
    And that's the perspective I think to use as a basis for the report
    CREATE OR REPLACE FORCE VIEW "BASE_VW" 
     
    AS
      SELECT Def.Def_Id,
        Def.First_Name,
        Def.Last_Name,
        Eng.Eng_Id,
        Eng.Court_Name,
        Eng.Date_Joined,
        Eng.Date_Terminated,
        Eng.Ethnicity,
        Ser.Service_Id,
        Ser.Description,
        Ser.Date_Started    AS Service_Start_Date,
        Ser.Date_Terminated AS Service_Date_Terminated,
        Ser.Active          AS Service_Active,
        Ev.Event_Id,
        Ev.Related_Service_Id,
        Ev.Start_Date,
        Ev.End_Date,
        Ev.Notes,
        ev.active AS event_active
      FROM Defendant Def
      LEFT OUTER JOIN Engagement Eng
      ON Def.Def_Id = Eng.Def_Id
      LEFT OUTER JOIN Service Ser
      ON Eng.Eng_Id = Ser.Eng_Id
      LEFT OUTER JOIN Event Ev
      ON Ev.Eng_Id = Eng.Eng_Id;
    ****
    Requirement:
    Report parameter: Start Date, end Date, Court_name
    Of selected Court_name, list of defendants who are currently participating in the Court.
    For each display of the defendant
    Section 1: Identification of the details: first name, surname, ethnicity, Date of arrival in the Court
    Section 2: All currently active Services that the defendant attend
    Section 3: All the events related to the service attending the defendant
    Section 4: All other events (don't have IDS Service related)

    The user must be able to download the full report in the spreadsheet or in PDF format.
    I tried to create a set of Union chooses (but the format is not that good, when no data return show nothing, I would like to show rather some messages as "There is no associated event, rather than nothing")
    and he produced a report for 1 defendant at the same time.

    We use Oracle APEX, so only select statement or statement select return PL/SQL Code is valid for the report source.
    At our place, we use Jasper adjacent report at the APEX, but I have very little experience with report of Jasper.
    The developer who knows a lot about the report of jasper is too busy to help me.

    Currently I use the union chooses as below:
    With Current_Engagement As
    ( Select Eng_Id From Engagement
      Where Def_Id =2
      And Date_Joined Is Not Null
      And ( Date_Terminated Is Null Or Date_Terminated > Sysdate)
      And Rownum =1
    )
    Select '1.Defendant ID' as col1, 'First Name' as col2, 'Last Name' as col3, 'Court Name' as col4, 'Ethnicity' as col5, 'Date Joined' as col6, 'Date Terminated' as col7
    From Dual
    
    Union All
    
    Select Distinct to_char(Def_Id), First_Name, Last_Name, Court_Name, Ethnicity, to_char(Date_Joined), to_char(Date_Terminated)
    From Base_Vw Inner Join Current_Engagement Ce On Base_Vw.Eng_Id = Ce.Eng_Id
    
    Union All 
    select '2.Service ID', 'Service Description', 'Start Date', 'End Date', Null, Null, Null
    from dual
    
    Union All
    
    Select distinct to_char(service_id), description, to_char(service_start_date), to_char(service_date_terminated), null, null, null
    From Base_Vw Inner Join Current_Engagement Ce On Base_Vw.Eng_Id = Ce.Eng_Id
    where service_active =1
    
    Union All
    Select '3.Event ID', 'Related Service ID', 'Start Date', 'End date', 'Notes', null, null
    From Dual
    
    Union All
    Select distinct to_char(event_id), to_char(related_service_id), to_char(start_date), to_char(end_date), notes, null, null
    from Base_Vw Inner Join Current_Engagement Ce On Base_Vw.Eng_Id = Ce.Eng_Id
    Where Event_Active = 1
    and related_service_id is not null
    
    Union All
    
    Select '4.Event ID', 'Start Date', 'End date', 'Notes', null, null, null
    From Dual
    
    Union All
    
    Select distinct to_char(event_id), to_char(start_date), to_char(end_date), notes, null, null, null
    From Base_Vw Inner Join Current_Engagement Ce On Base_Vw.Eng_Id = Ce.Eng_Id
    Where Event_Active = 1
    and related_service_id is null
    and the result is a bit what I try to achieve (except that I need to work on the screen a message "No data found" rather than anything), but it seems that my code works for one respondent.
    COL1                           COL2                           COL3                           COL4                 COL5                 COL6        COL7          
    ------------------------------ ------------------------------ ------------------------------ -------------------- -------------------- ----------- ---------------
    1.Defendant ID                 First Name                     Last Name                      Court Name           Ethnicity            Date Joined Date Terminated 
    2                              John                           Doe                            BBB                  Asian                01/10/12                    
    2.Service ID                   Service Description            Start Date                     End Date                                                              
    3                              Treatment                      01/10/12                       15/10/12                                                              
    6                              Treatment                      16/10/12                                                                                             
    3.Event ID                     Related Service ID             Start Date                     End date             Notes                                            
    5                              2                              03/10/12                                                                                             
    4.Event ID                     Start Date                     End date                       Notes                                                                 
    4                              02/10/12                                                                                                                            
    8                              12/10/12                                                                                                                            
    
     10 rows selected 
         
    However, I struggle to find a way to apply this to more than 1 defendant and always keep the format.
    Defendant 1
    All details related to defendant 1 
    Defendant 2
    All details relayed to defendant 2
    ...
    Defendant n
    All details relayed to defendant n
    Is it possible to view a report as above using only the SQL script?


    Thank you very much in advance. I'm ready to financially compensate someone who can give me a solution.

    Edited by: Ann586341. Base_vw SQL view script is fixed.

    Hi, Ann.

    The query I posted earlier can be simplified a bit. You need not partitioned outer joins, which means that you don't need d_num.

    WITH     current_engagement     AS
    (
         SELECT  Def.Def_Id
         ,     Def.First_Name
         ,         Def.Last_Name
         ,         Eng.Eng_Id
         ,         Eng.Court_Name
         ,         Eng.Date_Joined
         ,         Eng.Date_Terminated
         ,         Eng.Ethnicity
         ,     ROW_NUMBER () OVER ( PARTITION BY  def.def_id
                                   ORDER BY          eng.date_joined
                             ,                eng.eng_id
                           )      AS e_num
         FROM      Defendant   Def
           JOIN       Engagement  Eng  ON   Def.Def_Id = Eng.Def_Id
         WHERE     (   Eng.Date_Terminated  IS NULL
              OR  Eng.Date_Terminated      >= TO_DATE (:p_start_date, 'DD/MM/YYYY')
              )
         AND     Eng.Date_Joined           <= TO_DATE (:p_end_date,   'DD/MM/YYYY')
         AND     Eng.court_name           = :p_court_name
    )
    ,     event_types          AS
    (
         SELECT  3.2 AS event_type     FROM dual     UNION ALL
         SELECT     4.2                   FROM dual
    )
    ,     union_results          AS
    (               -- Section 1 Header: 1 row per defendant
         SELECT  '1.Defendant ID'     AS col1
         ,     'First Name'           AS col2
         ,     'Last Name'          AS col3
         ,     'Court Name'           AS col4
    --     ,      'Ethnicity'           AS col5 ...
         ,     def_id
         ,     1.1               AS section_num
         ,     0               AS r_num
         FROM     current_engagement
         WHERE     e_num     = 1
        UNION ALL          -- Section 1 Data: 1 row per defendant
             SELECT     TO_CHAR (def_id)        AS col1
         ,     first_name             AS col2
         ,     last_name             AS col3
         ,     court_name             AS col4
         ,     def_id
         ,     1.2               AS section_num
         ,     1               AS r_num
         FROM     current_engagement
         WHERE     e_num     = 1
        UNION ALL          -- Section 2 Header: 1 row per defendant
           SELECT  '2.Service ID'             AS col1
           ,       'Service Description'     AS col2
           ,       'Start Date'          AS col3
           ,       'End Date'          AS col4
           ,       def_id
           ,       2.1               AS section_num
           ,       0               AS r_num
           FROM    current_engagement
        UNION ALL          -- Section 2 Data: 1 row per service (at least 1 per defendant)
           SELECT DISTINCT
                       NVL ( TO_CHAR (s.service_id),  'No Data')      AS col1
           ,       NVL (s.description,            'No Data')      AS col2
           ,       NVL ( TO_CHAR (s.date_started, 'DD/MM/YYYY')
                               ,                           'No Data')        AS col3
           ,       NVL ( TO_CHAR (s.date_terminated, 'DD/MM/YYYY')
                               ,                           'No Data')      AS col4
           ,       ce2.def_id
           ,       2.2                               AS section_num
           ,       s.service_id                AS r_num
           FROM              current_engagement  ce2
           LEFT OUTER JOIN     service              s      ON   s.eng_id  = ce2.eng_id
                                       AND      s.active  = 1
        UNION ALL          -- Section 3 Header: 1 row per defendant
           SELECT  '3.Event ID'               AS col1
           ,       'Related Service ID'     AS col2
           ,       'Start Date'          AS col3
           ,       'End date'          AS col4
           ,       def_id
           ,       3.1               AS section_num
           ,       0               AS r_num
           FROM    current_engagement
        UNION ALL          -- Section 4 Header: 1 row per defendant
           SELECT  '4.Event ID'               AS col1
           ,       'Start Date'          AS col2
           ,       'End date'          AS col3
           ,       'Notes'               AS col4
           ,       def_id
           ,       4.1               AS section_num
           ,       0               AS r_num
           FROM    current_engagement
        UNION ALL          -- Section 3+4 Data: 1 row per event (at least 2 per defendant)
           SELECT DISTINCT
                       NVL ( TO_CHAR (e.event_id),    'No Data')      AS col1
           ,       NVL ( CASE  et.event_type
                                     WHEN  3.2
                    THEN  TO_CHAR (e.related_service_id)
                    ELSE  TO_CHAR (e.start_date, 'DD/MM/YYYY')
                   END
                               ,                     'No Data')      AS col2
           ,       NVL ( CASE  et.event_type
                                     WHEN  3.2
                    THEN  TO_CHAR (e.start_date, 'DD/MM/YYYY')
                    ELSE  TO_CHAR (e.end_date,   'DD/MM/YYYY')
                   END
                               ,                           'No Data')        AS col3
           ,       NVL ( CASE  et.event_type
                                     WHEN  3.2
                    THEN  TO_CHAR (e.end_date  , 'DD/MM/YYYY')
                    ELSE  e.notes
                   END
                               ,                           'No Data')      AS col4
           ,       ce34.def_id
           ,       et.event_type                          AS section_num
           ,       e.event_id                           AS r_num
           FROM              current_engagement  ce34
           CROSS JOIN     event_types         et
           LEFT OUTER JOIN     event              e      ON   e.eng_id  = ce34.eng_id
                                       AND  e.active  = 1
                                       AND  NVL2 ( e.related_service_id
                                                    , 3.2
                                                , 4.2
                                                )    = et.event_type
    )
    SELECT       col1, col2, col3, col4
    FROM       union_results
    ORDER BY  def_id
    ,            section_num
    ,       r_num
    ;
    
  • HELP: Need to code SQL to bulk move

    I use Oracle 11.2, there are two tables tb_base, tb_hist as follows:

    tb_base (number (5) id, varchar2 (16) tag, the timestamp pavers (6));
    tb_hist (id number (5), histTs timestamp (6), timestamp (6) the cobblestones, tag varchar2 (16));

    tb_base 1, "beard", 20/12/2012
    1, 'bbb', 08/12/2012
    1, "ccc", 12/30/2012
    2, 'aaa', 11/29/2012
    2, 'vvv', 28/11/2012

    All I need is to move the record iteration with the same id from tb_base to tb_hist as a result:

    tb_base 1, "ccc", 12/30/2012
    2, 'aaa', 12/29/2012

    tb_hist 1, "beard", 20/12/2012, 20/12/2012
    1, "bbb", 2012/12/08, 08/12/2012
    2, "vvv", 2012/11/28, 28/11/2012

    Any suggestion on the SQL to perform this task?

    Thank you

    Copy the historical records of TB_HIST:

    INSERT INTO tb_hist
    (id
    ,histts
    ,setts
    ,tag)
    SELECT id,
           setts,
           setts,
           tag
    FROM   tb_base a
    WHERE EXISTS (SELECT 1
                  FROM  (SELECT id,
                                MAX(setts) OVER (PARTITION BY id) max_setts
                         FROM   tb_base) b
                  WHERE  b.id         = a.id
                  AND    b.max_setts != a.setts)
    

    Remove the historical records of TB_BASE:

    DELETE tb_base a
    WHERE EXISTS (SELECT 1
                  FROM  (SELECT id,
                                MAX(setts) OVER (PARTITION BY id) max_setts
                         FROM   tb_base) b
                  WHERE  b.id         = a.id
                  AND    b.max_setts != a.setts)
    
  • Need to query SQL - oracle 8i

    Hello

    We use Oracle 8i (Oracle8i Enterprise Edition Release * 8.1.7.4.0 - 64 bit Production *).

    My requirement is-

    I need output like

    User_name company

    Suri 01,86,65
    Srinu 01,86,65


    Here are examples of data.
    WITH t AS ( SELECT 'SURI' user_name ,'01' Company FROM dual UNION ALL
                SELECT 'SURI' user_name, '86' Company FROM dual UNION ALL
                SELECT 'SURI' user_name ,'65' Company FROM dual UNION ALL
                SELECT 'SRINU' user_name, '01' Company FROM dual UNION ALL
                SELECT 'SRINU' user_name ,'86' Company FROM dual UNION ALL
                SELECT 'SRINU' user_name ,'65' Company FROM dual )
    SELECT * FROM t ;
    
    
    USER_NAME     COMPANY
    SURI              01
    SURI              86
    SURI              65
    SRINU              01
    SRINU              86
    SRINU              65
    Thank you very much in advance for the help.

    Thank you
    Suri

    Hello

    Suri wrote:
    ... Only one doubt ROW_NUMBER will work in Oracle 8i?

    What happens when try you it?

    It's in the manual of the SQL language for your version?
    http://docs.Oracle.com/CD/A87860_01/doc/server.817/a85397/index.htm

  • Determination of needs memory to SQL Server

    Hi all

    I've looked everywhere and can't seem to find the answer to this question.  And it seems strange because I really can't believe I'd be the first person in this situation.

    The situation:

    I pull some data on about 30 servers perfmon to size a new farm to run some of our external facing infrastructure.  I get good data most of the boxes (ui, search, intermediate level, etc.) but not the SQL servers.  Regardless of the load on the server, SQL seems to devour almost all available memory.  Read about managing memory SQL, it is not surprising that he would show the way in perfom and/or the Task Manager, but I need to get a handle on the amount of memory, these servers will need to function properly.

    I know that there is much more to the issue of performance, but a SQL Server in particular has 32 GB of physical memory and SQL is actively filling 30 of it.  It would make a horrible candidate (like less because our host record and consolidation target ratios) for virtual server.  That said, I like the impression that this server might work on much less and uses this 30G because he can.

    There are people who would say "Start with 4 G, test, and add more than necessary".  Unfortunately, this is not really an option for us given the timeline and the visibility of the migration.

    Thanks in advance to anyone who can provide assistance here!

    -Brent

    Personally I start with 1 GB and work toward the top, but this depends on how active do you think that the server is.  If you think its quite busy then try using 2 GB for the operating system and give 1.5 GB to SQL and see how it behaves.

    Unfortunately, SQL will use given to her in the SQL Manager properties before you begin to re - use all available memory.

    The only way to really tell is to determine if your server is under memory pressure and adjust accordingly.  Unfortunately, this means start low and going back as things are going to hell.

    This will help to see if your server knows the memory pressure

    http://www.4penny.NET/SQL-Server-Troublshooting.aspx

    Memory

    • Memory: Available bytes

    • Memory: Pages/sec reads

    • Process: Working together: sqlserver

    • SQL Server: Buffer Manager: Buffer Cache Hit Ratio

    • SQL Server: Memory Manager: Total memory of the server (KB)

    The memory: available bytes indicates the amount of physical memory, in bytes.

    immediately available for allocation to a process or for system use. It is a memory

    not currently in use by the system.

    The memory: pages/sec reads shows the rate, in incidents per second, at which the

    disk was read to resolve hard page faults. This counter indicates the number of read operations, without

    with regard to the number of pages retrieved in each operation. Hard page faults occur when a process

    fact refers to a virtual memory page that must be retrieved from disk because it is not in his

    working set or elsewhere in physical memory. This counter is a primary indicator for types

    defects that cause delays throughout the system.

    A low number of available bytes indicates that there may be not enough memory available;

    or processes, including SQL Server, may not be free memory. A high number of faults Pages/sec

    indicate excessive paging. A more in-depth look at individual instances of process: Page

    Defects/s, to see if the SQL Server process, for example, has an excessive paging can be

    necessary. A low rate of defects of Pages/sec (usually 5 to 10 per second) is normal, as the

    operating system will continue to make a home on the range of work.

    Ideally, we'd like for SQL Server to be the only application on the server and with most of

    the memory in the box. Add memory to a server and configure SQL Server to use is

    beyond the scope of this article, but the more, the better.

    The process: working together: sqlserver instance indicates the amount of memory that SQL Server

    use, in bytes. If the number is always less than the amount of SQL Server is configured

    for use by the MIN SERVER MEMORY and MAX SERVER MEMORY options, and then SQL Server is

    configured for too much memory. Otherwise, you may have to increase the RAM and MAX SERVER MEMORY.

    Buffer Cache Hit Ratio should be constantly greater than 90. This indicates that the

    data provided 90 per cent of requests for data cache. If this value is always

    low, it is a very good indicator that needs more memory to SQL Server. If it is available

    Bytes is low, which means that we should add more RAM.

    If the total memory of the server for SQL Server is always higher than the total memory of the server,

    It indicates that there is not enough RAM. This counter is in KB, as opposed to bytes for the process: working together: sqlserver

  • Need help for sql logic

    Hi guys,.


    I have the following requirement to fetch a value from the

    database with certain conditions. I'll give u an example of how

    data look like in the database and whaat I expect the result.

    Given in the table look like below

    File_No File_date rating Reac
    100 20100402 (white) (white)
    100 20080321 excellent (empty)
    100 20030610 (blank) 82
    20110501 200 (blank) 28
    20090815 200 (white) (white)
    20081021 300 (white) (white)
    300 20060225 good (empty)
    300 20051220 concern (empty)



    from the above table, I need to apply under logic
    I need choose classification or reactionary who never have the value in the table most recent recording. If most recent record has side or reactionary and previous record.

    IM waiting for given below accordingly for file _No

    100 20080321 excellent (empty)

    100 20030610 (blank) 82

    300 20060225 good (empty)


    Please let me know how to write sql/plsql code? Thanks in advance.

    Maybe (although not giving no expected result seems to follow the logic of obligation) NO TESTS!

    select file_no,file_date,rating,reac,
      from (select file_no,file_date,rating,reac,
                   row_number() over (partition by file_no order by file_date desc) r
              from table_a
             where coalesce(rating,to_char(reac)) is not null
           )
     where r = 1
    

    Concerning

    Etbin

    Edited by: Etbin on 28.8.2011 23:51

    I forgot the habit DO NOT TEST! (it should be because it's almost tomorrow)

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

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


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

    Dipabkar Bédard (DB) wrote:

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

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

    And without analytical functions:

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

    SY.

Maybe you are looking for

  • Cannot open the email to my hotmail accounts

    no real problems in hotmail logingbut when I'm inbox mail does not open so I can read it,can't compose an email. Oh, I use ubuntu 12.04 LTSI have opinions on other installs ubuntu products so don't know if this is it problem or firefox.Debian "Whezzy

  • Pavilion p6680t CTO Office: Pavilion p6680t CTO Desktop Ram Upgrade

    Desktop Pavilion p6680t CTO has now 4x2gb modules of RAM. I tried to replace both of them with 2 4 gb chips. Would not work. I tried all possible combinations of chips and will not work with the added 4gbs. Here's the new: Kingston Value RAM 4 GB 133

  • dv4-1435dx recovery fails

    When you perform a restore to original factory it fails during the "HP Software is installed. After several reboots, I get the following error: The attempt to retrieve filed. Please select one of the following buttons: (details and try again is displ

  • AXC-603-UR10 OS install after drive crash

    After a disk crash, I tried to install my own copy of Win10-Pro-64 on a new hard drive.  The installation seemed to go well until the computer has rebooted (as is normal during the installation) and entered the final stages of all prepares, how the l

  • What is an enabling technology and why is it prevents a restore of the default gateway

    I started with a virus. I have a gateway m series laptop PC with vista home premium.  My unit would be shut down and restart when I tried to put my password to open it.  I could only use safe mode - last configuration to open it.  I used the malwareb