Blocking and Deleting parent table row

Dear all,

I use Oracle Database 10 g Enterprise Edition Release 10.2.0.3.0 - 64 bit.

My application crashes when I try to delete the row in a parent table even if I do not have the child records for the corresponding parent row.

This may be due to, my records in the child table are in update mode, but they do not match my parent row.

Is it possible to force Delete parent row, when it has no child records?

Concerning
SankarMN

Tags: Database

Similar Questions

  • ORA-00054. Is possible to interrupt the cancellation and delete then table?

    Hello.

    I m import a long table with utility IMP.

    When has spent a lot of hours and the process was near complete I ORA-30036 and a restore operation was launched.

    I m trying to drop/truncate the table to avoid the wait, but the cause of the restore process I ORA-00054 and I have to wait for several hours to try to import again.

    My question is: there is a way to interrupt this restore operation and delete the table without inducing an inconsistent state of the database?

    I m working with Oracle 9i on Windows plataform

    concerning

    No, it isn't.

  • How to recover a frien that I blocked and deleted on facebook

    HI HOW TO RECOVER A FRIEND I HAVE DELETED AND BLOCKED ON FACEBOOK PLEASE THANK YOU

    Request support from Facebook. Absolutely nothing to do with Microsoft and Windows.

  • Delete a table row

    I had another problem when I delete a row after row of selection...

    javax.faces.el.EvaluationException: java.lang.NullPointerException at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130) at oracle.adf.view.faces.component.UIXComponentBase.__broadcast(UIXComponentBase.java:1079) at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:204) at oracle.adf.view.faces.component.UIXCollection.broadcast(UIXCollection.java:94) at oracle.adf.view.faces.component.UIXTable.broadcast(UIXTable.java:205) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)


    public void commandButton4_actionListener (ActionEvent action) {}
    Add the code in the event here...
    If (table1.getSelectionState () .getSize () == 0)
    {
    FacesContext ctx;
    CTX = FacesContext.getCurrentInstance ();
    FacesMessage fm = new FacesMessage (FacesMessage.SEVERITY_ERROR, "row SELCECT","" "");
    ctx.addMessage (ctx.getViewRoot (.getViewId ()), fm);

    Choose one of the following lines

    Returns a null value. If it is an Action
    If it's an ActionListener
    }
    else {}
    Table coreTable = getTable1();
    Selection of the iterator = table.getSelectionState () .getKeySet () .iterator ();
    String oldKey;
    oldKey = (String) table.getRowKey ();
    System.out.println ("before the Loop");
    While (Selection.hasNext ())
    {
    System.out.println ("after the loop");
    String rowKey = next (m:System.NET.SocketAddress.ToString ());
    System.out.println ("after casting");
    table.setRowKey (rowKey);
    TestcustomermasterViewRowImpl line = table.getRowData ((TestcustomermasterViewRowImpl));
    -System.out.println ("Before Removing"); - the action when I click on Remove button, the code is executed until this statement only. not enter enter row.markForDeletion)
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    row.markForDeletion ();
    System.out.println ("after delete");
    }
    restore the old key:
    table.setRowKey (oldKey);

    }

    Hello

    See: http://kuba.zilp.pl/?id=121

    Kuba

  • How torecuperate blocked and remove friends

    How restore a friend blocks and deletes on facebook

    Please select your language from the drop-down menu above to post your question in the language of your choice. The forum in which you've posted is for English only. If you can't find your language above, support for additional international sites options are by following the link below:

    http://support.Microsoft.com/common/international.aspx

    Please get your language in the drop-down list above pour post your question in the language of your choice. The forum you posted is in English only. If you can't find the language of your choice above, options of fees to pay to other international destinations can be found by following the link below:

    http://support.Microsoft.com/common/international.aspx

    For questions on Facebook, please ask the Facebook Support:

    For questions on Facebook, please ask Facebook to support:

    http://www.Facebook.com/help/

    http://www.Facebook.com/help/?page=220217228006012

    Thank you

  • Creation of update and delete triggers

    Hello

    I want to create 'update' and 'delete' a table 'T1_shadow' triggers that

    capture record during delete and Update Table 'T1 '.

    Kindly help

    You can use this:

    If the UPDATE can

    INSERT INTO T1_SHADOW

    values

    ('UPDATE',: old.customer_id,: old.customer_name,: old.city, sysdate, fnd_global.user_id);

    elsif DELETION then

    INSERT INTO T1_SHADOW

    values

    (' DELETE',:old.customer_id,: old.customer_name,: old.city, sysdate, fnd_global.user_id ");

    end if;

    end;

  • COMPARING TWO ROWS IN THE SAME TABLE AND DELETE THEM USING DELETION BLOCK

    Hi all
    I have a problem. I have an Employee table

    employee

    Emp_name Emp_id Emp_status Emp_date

    John 1 P 11-27-2010

    Mike 2 26/11/2010 S

    Simon P 3 22 / 11 / 2010

    Dennis C 4 25/11/2010...


    I compare the rows in the table and their employee_status if 'P', should I remove the... Here, I should delete lines 1 and 3 as their Emp_status is 'P '. I only use BULK DELETE... I tried to use the join query internal and deletion, but it does not work... Can someone help me...

    Ooops, it should be:

    and e2.emp_status in ('P', 'C')

    not

    and e2.emp_status in ('P', 'A')

    Here it goes:

    SQL> select  *
      2    from  employees
      3  /
    
    E EMP_NAME      EMP_KEY          X
    - ---------- ---------- ----------
    C John              123          1
    P Mike              123          2
    P Paul              123          6
    C Harry             124          5
    A Gass              125          7
    C Gass              125          7
    
    6 rows selected.
    
    delete  employees e1
      where 2 = (
                 select  count(distinct e2.emp_status)
                      from  employees e2
                      where e2.emp_key = e1.emp_key
                        and e2.emp_status in ('P','C')
                   )
    /
    
    3 rows deleted.
    
    SQL>
    

    SY.

  • Unable to delete all the rows in the table

    Hi all

    According to the time range I'm removing the equipment data and travel work shifts then insert new data of mth_site_shift_definitions in the work day moves and equipment move the table. If mth_Site_shift_definitions table has three rows for a given plant and I delete the two lines in a time then I am able to delete data for movement of equipment and work sihfts table, and then click Insert data in a single row in these two tables, but when I try to remove the last line I get an SQL exception. Can someone tell me the reason for this exception. In fact, I want that if we delete the last row also mth_Site_shift_definitions then the corresponding data should also get demolished transfers of equipment and work instead of give to the exception. I have this code:

    PROCEDURE GENERATE_SHIFTS (p_plant_fk_key in NUMBER,
    p_start_date IN this update,
    p_end_date IN DATE)
    IS
    -declation of local variable

    l_plant_fk_key NUMBER;
    l_sysdate DATE: = sysdate; - sysdate variable
    l_last_update_system_id NUMBER;
    l_last_update_date DATE;
    l_plant_pk VARCHAR2 (120);
    l_start_time varchar2 (8); - variable to store the start time
    l_end_time VARCHAR2 (8); - variable to store end_time
    l_graveyard VARCHAR2 (30);
    number of l_shift_num;
    l_shift_name VARCHAR2 (240);
    l_line_num NUMBER;
    l_start_date DATE;
    l_end_date DATE;
    NUMBER of l_start_time1;
    NUMBER of l_end_time1;
    l_equipment_fk_key NUMBER;
    NUMBER of l1_plant_fk_key;
    Number of N;
    l_creation_system_id NUMBER;
    -l_organization_code VARCHAR2 (120);
    l_system_fk_key NUMBER;
    l_site_id NUMBER;
    l_entity_pk_key NUMBER;
    l_entity_name VARCHAR2 (100);
    l_entity_type VARCHAR2 (30);
    l_production_entity VARCHAR2 (1);
    l_shift_workday_pk_key NUMBER;
    DATE of l1_shift_date;
    l_from_date DATE;
    l_to_date DATE;
    l_shift_type VARCHAR2 (30);
    -l_graveyard_shift NUMBER;
    CURSOR c_shift_def IS

    Select the value of start_time, end_time, cemetery, shift_num, shift_name, shift_type
    -in l_start_time, l_end_time, l_graveyard, l_shift_num, l_line_num, l_shift_name, l_shift_type
    Of

    mth_site_shift_definitions where plant_fk_key = p_plant_fk_key;

    BEGIN

    l_plant_fk_key: = p_plant_fk_key;
    l_start_date: = p_start_date;
    l_end_date: = p_end_date;
    l_system_fk_key: = 'MTH_UTIL_PKG. ' "MTH_UA_GET_VAL"();

    -DELETE FROM mth_workday_shifts_D WHERE plant_fk_key = l_plant_fk_key and shift_date > = l_start_date;
    DELETE FROM mth_workday_shifts_D WHERE plant_fk_key = l_plant_fk_key and Trunc (from_date) > = l_start_date AND Trunc (from_date) < = l_end_date;
    DELETE FROM mth_workday_shifts_D WHERE plant_fk_key = l_plant_fk_key and shift_date > = l_start_date AND shift_date < = l_end_date;
    DELETE FROM mth_equipment_shifts_d WHERE availability_date > = l_start_date AND availability_date < = l_end_date
    AND equipment_fk_key IN (SELECT DISTINCT (Nvl(a.equipment_fk_key,0))
    OF mth_equipment_shifts_d a, mth_equipments_d b WHERE the b.equipment_pk_key = a.equipment_fk_key AND b.plant_fk_key = l_plant_fk_key
    UNION ALL
    Separate (SELECT Nvl(a.equipment_fk_key,0))
    OF mth_equipment_shifts_d a, mth_resources_d b WHERE the b.resource_pk_key = a.equipment_fk_key AND b.plant_fk_key = l_plant_fk_key

    UNION ALL
    Separate (SELECT Nvl(a.equipment_fk_key,0))
    OF mth_equipment_shifts_d a, mth_plants_d b WHERE the b.plant_pk_key = a.equipment_fk_key AND b.plant_pk_key = l_plant_fk_key

    UNION ALL
    Separate (SELECT Nvl(a.equipment_fk_key,0))
    OF mth_equipment_shifts_d a, mth_equip_entities_mst b WHERE the b.entity_pk_key = a.equipment_fk_key AND b.plant_fk_key = l_plant_fk_key
    );

    FOR l_shift_def IN c_shift_def
    LOOP

    l_start_time: = l_shift_def.start_time;
    l_end_time: = l_shift_def.end_time;
    l_graveyard: = l_shift_def.graveyard;
    l_shift_num: = l_shift_def.shift_num;
    -l_line_num: = l_shift_def.line_num;
    l_shift_name: = l_shift_def.shift_name;
    l_shift_type: = l_shift_def.shift_type;



    Select plant_pk in the mth_plants_d l_plant_pk where plant_pk_key = l_plant_fk_key;
    -SELECT organization_code INTO l_organization_code FROM mth_organizations_l WHERE plant_fk_key =
    -l_plant_fk_key;
    N: = l_end_date-l_start_date;

    because me in 1... N + 1
    LOOP



    l_last_update_system_id: = - 99999.
    l_last_update_date: = l_sysdate;
    l_creation_system_id: = - 1;
    l_start_time1: = TO_NUMBER (SUBSTR (l_start_time, 1, 2)) * 3600 +.
    TO_NUMBER (substr (l_start_time, 4, 2)) * 60 +.
    TO_NUMBER (substr (l_start_time, 7, 2));

    l_end_time1: = TO_NUMBER (SUBSTR (l_end_time, 1, 2)) * 3600 +.
    TO_NUMBER (substr (l_end_time, 4, 2)) * 60 +.
    TO_NUMBER (substr (l_end_time, 7, 2));


    INSERT INTO mth_workday_shifts_D (shift_workday_pk_key, shift_workday_pk,
    shift_date, shift_date_julian, plant_fk_key, shift_type,
    from_date, to_date, shift_num, graveyard_shift, shift_name,
    source_org_code, system_fk_key,
    CREATION_DATE, last_update_date, creation_system_id,
    last_update_system_id)
    VALUES (mth.mth_workdays_shifts_s.nextval,
    TO_CHAR (DECODE (GREATEST (l_start_time1, l_end_time1),
    l_start_time1, l_start_date,
    l_start_date) + ((TO_NUMBER (SUBSTR (l_start_time, 1, 2)) +))
    (TO_NUMBER (SUBSTR (l_start_time, 4, 2)) / 60) +.
    ((TO_NUMBER (SUBSTR (l_start_time, 7, 2)) / 3600)) (/ 24),
    "(AAAAMMJJ-hh24:mi:ss') ' | '-'|" l_shift_num | » -'|| l_plant_pk,
    DECODE (GREATEST (l_start_time1, l_end_time1), l_start_time1,)
    l_start_date + Decode (l_shift_def.graveyard, 'SED', 1, 0), l_start_date).
    TO_NUMBER (TO_CHAR (l_start_date, 'J')),
    l_plant_fk_key, l_shift_type, l_graveyard,
    l_start_date + ((TO_NUMBER (SUBSTR (l_start_time, 1, 2)) +))
    (TO_NUMBER (SUBSTR (l_start_time, 4, 2)) / 60) +.
    ((TO_NUMBER (SUBSTR (l_start_time, 7, 2)) / 3600)) (/ 24),
    DECODE (GREATEST (l_start_time1, l_end_time1), l_start_time1,)
    l_start_date + ((TO_NUMBER (SUBSTR (l_end_time, 1, 2)) +))
    (TO_NUMBER (SUBSTR (l_end_time, 4, 2)) / 60) +.
    ((TO_NUMBER (SUBSTR (l_end_time, 7, 2)) / 3600)) (/ 24) + Decode (l_shift_def.graveyard, 'SED', 1, 0),
    l_start_date + ((TO_NUMBER (SUBSTR (l_end_time, 1, 2)) +))
    (TO_NUMBER (SUBSTR (l_end_time, 4, 2)) / 60) +.
    ((TO_NUMBER (SUBSTR (l_end_time, 7, 2)) / 3600)) ((/ 24)),
    l_shift_num, l_shift_name, null, l_system_fk_key.
    l_sysdate, l_sysdate,
    (l_creation_system_id, l_last_update_system_id);
    l_start_date: = l_start_date + 1;


    END LOOP;
    COMMIT;



    l_start_date: = p_start_date;


    IF SUPERIOR (l_shift_type) = "BOTH" THEN
    INSERT INTO mth_equipment_shifts_d (equipment_fk_key, availability_date, shift_workday_fk_key, from_date, To_Date, line_num, availability_flag, entity_type, creation_date, last_update_date, creation_system_id,
    (last_update_system_id)

    SELECT b.entity_pk_key entity_pk_key, a.shift_date shift_date, a.shift_workday_pk_key shift_workday_fk_key, a.from_date from_date, To_Date, 1 line_num, 'Y', a.to_date
    b.entity_type entity_type, SYSDATE-1, SYSDATE,-99999

    -IN l_site_id, l_entity_pk_key, l_entity_name, l_entity_type, l_production_entity,.
    -l_shift_workday_pk_key, l1_shift_date, l_from_date, l_to_date
    Mth_workday_shifts_d a.,
    (
    SELECT site_id plant_fk_key, entity_pk_key, entity_name, entity_type, production_entity production_entity
    OF mth.mth_equip_entities_mst
    UNION ALL
    SELECT plant_pk_key site_id, plant_pk_key entity_pk_key, plant_name entity_name, "SITE", production_site production_entity
    OF mth.mth_plants_d
    UNION ALL
    SELECT plant_fk_key site_id, resource_pk_key entity_pk_key, nom_entite resource_name, "RESOURCE", production_resource production_entity
    OF mth.mth_resources_d
    UNION ALL
    SELECT plant_fk_key site_id, equipment_pk_key entity_pk_key, equipment_name entity_name, "EQUIPMENT", production_equipment production_entity
    OF mth.mth_equipments_d
    ) b
    WHERE b.site_id = a.plant_fk_key
    AND a.plant_fk_key = l_plant_fk_key
    AND shift_date > = l_start_date
    AND shift_date < = l_end_date
    AND SUPERIOR (a.shift_type) = "BOTH".
    - AND a.line_num = l_line_num
    AND a.shift_num = l_shift_num
    AND a.shift_name = l_shift_name
    AND l_shift_def.start_time = To_Char(from_date,'HH24:MI:SS')
    AND l_shift_def.end_time = To_Char(To_Date,'HH24:MI:SS'));)

    END IF;
    IF SUPERIOR (l_shift_type) = 'PROD-SHIFT' THEN
    INSERT INTO mth_equipment_shifts_d (equipment_fk_key, availability_date, shift_workday_fk_key, from_date, To_Date, line_num, availability_flag, entity_type, creation_date, last_update_date, creation_system_id,
    (last_update_system_id)

    SELECT b.entity_pk_key entity_pk_key, a.shift_date shift_date, a.shift_workday_pk_key shift_workday_fk_key, a.from_date from_date, To_Date, 1 line_num, 'Y', a.to_date
    b.entity_type entity_type, SYSDATE-1, SYSDATE,-99999

    -IN l_site_id, l_entity_pk_key, l_entity_name, l_entity_type, l_production_entity,.
    -l_shift_workday_pk_key, l1_shift_date, l_from_date, l_to_date
    Mth_workday_shifts_d a.,
    (
    SELECT site_id plant_fk_key, entity_pk_key, entity_name, entity_type, production_entity production_entity
    OF mth.mth_equip_entities_mst
    UNION ALL
    SELECT plant_pk_key site_id, plant_pk_key entity_pk_key, plant_name entity_name, "Site", production_site production_entity
    OF mth.mth_plants_d
    UNION ALL
    SELECT plant_fk_key site_id, resource_pk_key entity_pk_key, nom_entite resource_name, "Resource", production_resource production_entity
    OF mth.mth_resources_d
    UNION ALL
    SELECT plant_fk_key site_id, equipment_pk_key entity_pk_key, equipment_name entity_name, "Equipment", production_equipment production_entity
    OF mth.mth_equipments_d
    ) b
    WHERE b.site_id = a.plant_fk_key
    AND a.plant_fk_key = l_plant_fk_key
    AND shift_date > = l_start_date
    AND shift_date < = l_end_date
    AND b.production_entity = 'Y'
    AND SUPERIOR (a.shift_type) = "PROD-SHIFT."
    - AND a.line_num = l_line_num
    AND a.shift_num = l_shift_num
    AND a.shift_name = l_shift_name
    AND l_shift_def.start_time = To_Char(from_date,'HH24:MI:SS')
    AND l_shift_def.end_time = To_Char(To_Date,'HH24:MI:SS'));)

    END IF;
    IF SUPERIOR (l_shift_type) = 'NON-PROD-SHIFT' THEN
    INSERT INTO mth_equipment_shifts_d (equipment_fk_key, availability_date, shift_workday_fk_key, from_date, To_Date, line_num, availability_flag, entity_type, creation_date, last_update_date, creation_system_id,
    (last_update_system_id)

    SELECT b.entity_pk_key entity_pk_key, a.shift_date shift_date, a.shift_workday_pk_key shift_workday_fk_key, a.from_date from_date, To_Date, 1 line_num, 'Y', a.to_date
    b.entity_type entity_type, SYSDATE-1, SYSDATE,-99999

    -IN l_site_id, l_entity_pk_key, l_entity_name, l_entity_type, l_production_entity,.
    -l_shift_workday_pk_key, l1_shift_date, l_from_date, l_to_date
    Mth_workday_shifts_d a.,
    (
    SELECT site_id plant_fk_key, entity_pk_key, entity_name, entity_type, production_entity production_entity
    OF mth.mth_equip_entities_mst
    UNION ALL
    SELECT plant_pk_key site_id, plant_pk_key entity_pk_key, plant_name entity_name, "Site", production_site production_entity
    OF mth.mth_plants_d
    UNION ALL
    SELECT plant_fk_key site_id, resource_pk_key entity_pk_key, nom_entite resource_name, "Resource", production_resource production_entity
    OF mth.mth_resources_d
    UNION ALL
    SELECT plant_fk_key site_id, equipment_pk_key entity_pk_key, equipment_name entity_name, "Equipment", production_equipment production_entity
    OF mth.mth_equipments_d
    ) b
    WHERE b.site_id = a.plant_fk_key
    AND a.plant_fk_key = l_plant_fk_key
    AND shift_date > = l_start_date
    AND shift_date < = l_end_date
    AND b.production_entity =' no
    AND SUPERIOR (a.shift_type) = "NON-PROD-SHIFT."
    - AND a.line_num = l_line_num
    AND a.shift_num = l_shift_num
    AND a.shift_name = l_shift_name
    AND l_shift_def.start_time = To_Char(from_date,'HH24:MI:SS')
    AND l_shift_def.end_time = To_Char(To_Date,'HH24:MI:SS'));)

    END IF;

    COMMIT;
    END LOOP;

    l_start_date: = p_start_date;

    because me in 1... N + 1
    LOOP


    l_last_update_system_id: = - 99999.
    l_last_update_date: = l_sysdate;
    l_creation_system_id: = - 1;

    INSERT INTO mth_workday_shifts_D (shift_workday_pk_key, shift_workday_pk,
    shift_date, shift_date_julian, plant_fk_key, shift_type, graveyard_shift, from_date, to_date, shift_num, shift_name, source_org_code, system_fk_key,
    CREATION_DATE, last_update_date, creation_system_id,
    last_update_system_id)
    VALUES (mth.mth_workdays_shifts_s.nextval, l_start_date |) » -'|| l_plant_pk | 'MTH_UTIL_PKG '. "MTH_UA_GET_VAL"(), l_start_date, TO_NUMBER (TO_CHAR (l_start_date, 'J')),
    l_plant_fk_key, 'TWO', null, null,
    NULL, null, FND_PROFILE. VALUE ('MTH_CATCH_ALL_NAME'), null, l_system_fk_key,
    l_sysdate, l_sysdate, l_creation_system_id, l_last_update_system_id);
    l_start_date: = l_start_date + 1;


    END LOOP;
    COMMIT;
    l_start_date: = p_start_date;

    INSERT INTO mth_equipment_shifts_d (equipment_fk_key, availability_date, shift_workday_fk_key, from_date, To_Date, line_num, availability_flag, entity_type, creation_date, last_update_date, creation_system_id,
    (last_update_system_id)

    SELECT b.entity_pk_key entity_pk_key, a.shift_date shift_date, a.shift_workday_pk_key shift_workday_fk_key, Trunc (a.shift_date) from_date, Trunc (a.shift_date) To_Date, 1 line_num, 'Y ',.
    b.entity_type entity_type, SYSDATE-1, SYSDATE,-99999

    -IN l_site_id, l_entity_pk_key, l_entity_name, l_entity_type, l_production_entity,.
    -l_shift_workday_pk_key, l1_shift_date, l_from_date, l_to_date
    Mth_workday_shifts_d a.,
    (
    SELECT site_id plant_fk_key, entity_pk_key, entity_name, entity_type, production_entity production_entity
    OF mth.mth_equip_entities_mst
    UNION ALL
    SELECT plant_pk_key site_id, plant_pk_key entity_pk_key, plant_name entity_name, "Site", production_site production_entity
    OF mth.mth_plants_d
    UNION ALL
    SELECT plant_fk_key site_id, resource_pk_key entity_pk_key, nom_entite resource_name, "Resource", production_resource production_entity
    OF mth.mth_resources_d
    UNION ALL
    SELECT plant_fk_key site_id, equipment_pk_key entity_pk_key, equipment_name entity_name, "Equipment", production_equipment production_entity
    OF mth.mth_equipments_d
    ) b
    WHERE b.site_id = a.plant_fk_key
    AND a.plant_fk_key = l_plant_fk_key
    AND shift_date > = l_start_date
    AND shift_date < = l_end_date
    AND SUPERIOR (a.shift_type) = "BOTH".
    AND a.FROM_DATE IS NULL
    AND one. To_Date IS NULL
    - AND a.line_num = NULL
    AND a.shift_num IS NULL
    );



    -exception handling
    -EXCEPTION
    -WHEN NO_DATA_FOUND THEN
    -RAISE_APPLICATION_ERROR (-20001,
    -"An exception occurred');

    END GENERATE_SHIFTS;

    Thanks a lot for your help.
    Kind regards
    Amrit

    You have assigned data to N in the loop of the cursor which doesnot have given.

    N := l_end_date-l_start_date;
    

    Assign the value out of the loop as it doesnot has nothing to do with the cursor data.

    Twinkle

  • ALTER TABLE RETRACTABLE and DELETE are same as far as space is concerned. Right?

    DB version: 11.2.0.4

    OS: Oracle Linux 6.5

    In my shop, we want to do a data cleanup (purge) so that we don't have to buy additional storage.

    As far as I know, that when you can do a manual resizing of the data file, you can release space back to the system of files/Diskgroup.

    SHRINK and DELETE free space for the data file, but it will create empty blocks for future insertions/changes.

    Imagine a tablespace with a single file data (32GB) and 1 single segment. This segment can be created anywhere in a data file. In this 32 GB datafile oracle may place this segment in the 25 GB. So even if the total space used in the data file is 10 MB, you can resize only to 25 GB!  The solution for this is to move the debate and then run an ALTER DATABASE DATAFILE... RESIZE the control.

    But this 'moving segment' approach is not practical when want to deal with a lot of data with a lot of segments in her files.

    Back to my original question about SHRINK and DELETE; If SHRINK and DELETE can free space in a data file, there is virtually no difference between SHRINK and REMOVE what little space is. Right?

    Thus, the only advantage of SHRINK on delete, I can think of is that SHRINK will lower the HWM to the level of the segment so that Oracle does not have to scan all blocks (a lot of blocks empty sometimes) under the HWM of the segment.

    My assumptions are correct?

    I see no link between SHRINK and REMOVE.

    However, your understanding of SPACE SHRINK is defective. Unless you explicitly use the COMPACT clause, a therapist will indeed free degrees and therefore make space available in the data file.

  • Anonymous blocks that goes down and creates a table

    Version: 11.2.0.3

    I'm relatively new to PL/SQL.

    We have a table named CHK_CNFG_DTL.

    I want to create a backup table for CHK_CNFG_DTL who will be named as CHK_CNFG_DTL_BKP_ < timestamp > for example: CHK_CNFG_DTL_BKP_JULY_22_2013

    Creating this backup table must be automated, so I want to create an anonymous block that will first remove the existing backup table and then create a new backup of the original table.

    The code below works fine. But the first time when you run it, the loop will not iterate because there is no such table named % CHK_CNFG_DTL_BKP.

    declare

    v_stmt varchar2 (1000);

    date of T_DATE;

    Start

    for rec in

    (select * from user_tables where table_name like '% CHK_CNFG_DTL_BKP')

    loop

    Start

    run immediately "alter session set nls_date_format =" DD_MON_YYYY "';"

    v_stmt: = 'drop table' | Rec.table_name | "purge."

    dbms_output.put_line (v_stmt);   -Old backup drops table

    immediately run v_stmt;

    Select sysdate in double T_DATE;

    v_stmt: = "create table CHK_CNFG_DTL_BKP_ | TO_DATE (V_DATE): ' in select * from CHK_CNFG_DTL';

    dbms_output.put_line ('Bkp création table CHK_CNFG_DTL_BKP_' | to_date (v_date));

    dbms_output.put_line (v_stmt);

    immediately run v_stmt;  -Creates the new table of backup

    exception

    while others

    then

    dbms_output. Put_line (rec.table_name |'-'|) SQLERRM);

    end;

    end loop;

    end;

    /

    PL/SQL procedure successfully completed.

    -Backup table was not created.

    SQL > select table_name from user_Tables where table_name like '% CHK_CNFG_DTL ';

    TABLE-NAME

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

    CHK_CNFG_DTL

    Of course, this can fixed by creating a table as bleow before running the anonymous block

    SQL > create table CHK_CNFG_DTL_BKP_JULY_22_2013 (x varchar2 (37));

    Table created.

    and now the block will be executed with success as

    24 end;

    25.

    drop table CHK_CNFG_DTL_BKP_JULY_22_2013 purge

    Creating table Bkp CHK_CNFG_DTL_BKP_22_JUL_2013

    create the table CHK_CNFG_DTL_BKP_22_JUL_2013 select * from CHK_CNFG_DTL

    PL/SQL procedure successfully completed.

    But it goes to production. We cannot have a table like CHK_CNFG_DTL_BKP_JULY_22_2013 without an appropriate reason.

    How can I change the code above so that if even if there is no such like '% CHK_CNFG_DTL_BKP' table, he will create the backup table?

    Hello

    Why don't you press the create backup of the loop?

    declare

    v_stmt varchar2 (1000);

    date of T_DATE;

    Start

    for rec in

    (select * from user_tables where table_name like 'CHK_CNFG_DTL_BKP %')

    loop

    Start

    run immediately "alter session set nls_date_format =" DD_MON_YYYY "';"

    v_stmt: = 'drop table' | Rec.table_name | "purge."

    dbms_output.put_line (v_stmt);   -Old backup drops table

    immediately run v_stmt;

    exception

    while others

    then

    dbms_output. Put_line (rec.table_name |'-'|) SQLERRM);

    end;

    end loop;

    Select sysdate in double T_DATE;

    v_stmt: = "create table CHK_CNFG_DTL_BKP_ | TO_DATE (V_DATE): ' in select * from CHK_CNFG_DTL';

    dbms_output.put_line ('Bkp création table CHK_CNFG_DTL_BKP_' | to_date (v_date));

    dbms_output.put_line (v_stmt);

    immediately run v_stmt;  -Creates the new table of backup

    end;

  • How to upgrade the parent table and child by updating the parent table

    I have a parent EMPLOYEE table that includes columns (sysid, serviceno, employeename...) sysid is the primary key, serviceno is the Unique key and I have DEPENDENT child table includes columns (sysid, employee_sysid, name, date of birth...) there still SYSID is a primary key for the table of dependants, employee_sysid is a foreign key in the EMPLOYEE table.

    Now I want to change SYSID (with the help of the sequence) in the EMPLOYEE table that they want an update in the table of people dependent

    Note: I have 10000 records in the EMPLOYEE table as I have 5 more children tables that need to update new SYSID.

    Please help me

    first disable FOREIGN KEY constraints.
    You can update Parent and child record with the help of the trigger.
    Here I give you an examlpe... It can help u.

    create a parent (id number primary key, name varchar2 (100)) table
    /
    create table child_1 (primary key id, p_id number number, date of birth, date)
    CONSTRAINT FK_id FOREIGN KEY (p_id) REFERENCES parent (ID))
    /
    create table child_2 (key primary id, p_id2, addr varchar2 number number (1000))
    CONSTRAINT FK_id2 FOREIGN KEY (p_id2) REFERENCES parent (ID))
    /

    Insert some test data for the parent tables and children.

    change the constraint to disable child_2 table FK_id2
    /
    change the constraint to disable child_1 table FK_id2
    /

    CREATE OR REPLACE TRIGGER delete_child
    BEFORE parent UPDATE ON
    FOR EACH LINE
    BEGIN
    UPDATE CHILD_1
    P_ID =:NEW.ID SET
    WHERE P_ID =:OLD.ID;
    UPDATE CHILD_2
    SET = P_ID2: NEW.ID
    WHERE P_ID2 =:OLD.ID;
    END;
    /

    then Upadte parent table primary key col and check the children tables.
    do enable constraints...

  • find and delete blocks of text with the same geometricBounds

    Hi writer... .new question from here:

    mySelection var = app.activeDocument.selection [0] .geometricBounds;

    alert (mySelection);

    throughout the document, I need search and delete blocks of text with the same geometricBounds.

    If possible, the same dimensions, but not the same positions.

    Thanks for the help!

    OK Bala... .in to decimal differences, some executives have not been removed.

    I solved with "Math.round' instead of 'number '.

    ===================

    mySelection var = app.activeDocument.selection [0] .geometricBounds;

    var myWidth = Math.round(mySelection[3]-mySelection[1]);

    var myHeight = Math.round(mySelection[2]-mySelection[0]); Alert (myHeight);

    var allFrames = app.activeDocument.allPageItems;

    While (t = allFrames.pop ()) {}

    {if (t.IsValid)}

    var myTextframe = t.geometricBounds;

    var myTWidth = Math.round(myTextframe[3]-myTextframe[1]);

    var myTHeight = Math.round(myTextframe[2]-myTextframe[0]);

    If ((myWidth == myTWidth) & (myHeight == myTHeight)) {}

    t.Remove ();

    }

    }

    }

    ===================

    Now, your script works great!

    Thank you very much!

  • Framemaker10: cannot cut and paste tables, rows, or columns

    When I select a table row, copy and then try to paste a new row, only Pasty in text. When I Edition > paste special, the only options provided are text , and Unicode text.

    I used to be able to copy / paste lines, but this is no longer an option. If anyone has experienced this? Know a fix?

    Edit my maker.ini files does not fix it.

    This has probably been fixed by the discovery that a plug-in toolbar Skype messes up ability to the Clipboard for copy/paste of the text - it is be the culprit in a couple of other threads on the forum.

  • BULL, INSERTION IN THE PARENT TABLE AND THE CHILD TABLE

    Hi all

    We use bulk insert to improve performance. How to use this concept when I insert the records parent in table parent and child?

    example... I have a procedure that accepts the array of student objects

    each student object is defined as *(student name, student age, course_object_array) *.

    the 3rd element course_object_array is defined as *(coursename,course fee,facultyname) *.

    a student can be associated with several courses

    Now, I have to insert the data into two tables namely students (studentname, studentage and student_number)
    courses (course_id, coursename, fees, facultlyname, student_number)

    I use sequences to fill the columns student_number and course_id.

    If I use bulk insert, and insert all the records in the parent table how do I the association for each record of a child. How will I know what child folder must be associated with which of the parents?

    Concerning
    REDA

    raj_fresher wrote:
    Hi thanks for the reply Solomon.

    I actually know about the bulk collect and for all...

    Have you read that FOR ALL with in fact BULK COLLECT? It will allow you to bulk insert via for ALL with VOTING student_numbers attributed to each student placed in a collection. Then, you will use this collection collection of course list to fill the RACE table.

    SY.

  • Data block in the procedure and the Base Table

    Hello

    I hava a form with a block of master and detail. The fields in the Master block are

    Emp_name, DateOfJoin, salary... I created this block with the procedure with a Ref Cursor, becaue the user
    want to load the data based on the conditions it enter for example: DateOfJoin < = Sysdate and DateOfJoinn July 1, 2008 "."
    SO I created a block of control with the fields name, MiddleName, LastName, of DateOfJoin, in DateOfJoin, the salary, and when the user clicks on the data loading
    button, I load the data to block under these conditions using the procedure.
    Note that in the Emp_Name table if a field, but contain first name, middle name, and last name with a separate space.

    My needs is, is there any method to develop this master block with a database table, so that if the user want to select it
    data based on other conditions, it can enter directly into the block of data using Qry enter and run Qry, also if he wants to
    Select data based on the top-level asked the search criteria, it will click Load Data.
    I hope that in this case, when the user selected the Load data button, I need to change the data source to the Type of procedure and set the source of data on behalf of the procedure name.

    Is there any other easy solution flor this

    Thanks in advance

    not sure if I get your needs. I understand the following:
    You have a block based on table emp, containing a DateOfJoin column and the user should be able to enter into a 'complex' where denomination.

    To do this, you do not have to base block one a procedure or ref_cursor. Two possibilities:

    Add two fields more directly in the block that are non-base of data-objects of type date fixed query on yes and let the user to enter a date range in these columns. In the accumulation of PRE-QUERY-trigger a WHERE condition by using the value in this field:

    something like:

    DECLARE
      vcMin VARCHAR2(10):='01.01.1700';
      vcMax VARCHAR2(10):='01.01.2999';
    BEGIN
      IF :BLOCK.DATE_FROM_JOIN IS NOT NULL THEN
        vcMin:=TO_CHAR(:BLOCK.DATE_FROM_JOIN, 'DD.MM.YYYY');
      END IF;
      IF :BLOCK.DATE_TO_JOIN IS NOT NULL THEN
        vcMax:=TO_CHAR(:BLOCK.DATE_TO_JOIN, 'DD.MM.YYYY');
      END IF;
      SET_BLOCK_PROPERTY('BLOCK', ONETIME_WHERE, 'DATEOFJOIN BETWEEN TO_DATE(''' || vcMin || ''', ''DD.MM.YYYY'') AND TO_DATE(''' || vcMax || ''', ''DD.MM.YYYY'')');
    END;
    

    Another option:
    together, the length of the request of the DATEOFJOIN field to say 255, then the user can directly enter #BETWEEN fromdate AND fodate in the field.

Maybe you are looking for