Delete data table Parent and child data automatically delete or the value null in the foreign key of the child table.

Oracle 10g

Hi gurus

I test_mst table that has a primary key test_mst.test_id, I detail table test_dtl which has test_dtl.test_id of foreign key, now I have that I want to use the delete statement in test_mst then it should also remove the constraint of her child or null in test_dtl.test_id, can again do in oracle 10g?

Thanks in advance

Hi Mit.

example of cascade

create table bill(
  bill_id number not null primary key
)
;
create table bill_item(
  bill_item_id number not null primary key,
  bill_id number references bill(bill_id) on delete cascade
)
;
insert into bill values (1)
;
insert into bill_item values (1, 1)
;
delete bill
;
select * from bill_item
;
drop table bill_item purge
;
drop table bill purge
;

Table BILL created.
Table BILL_ITEM created.
1 row inserted.
1 row inserted.
1 row deleted.

no rows selected

Table BILL_ITEM dropped.
Table BILL dropped.

exemplary null

create table employer(
  employer_id number not null primary key
)
;
create table employee(
  employee_id number not null primary key,
  employer_id number references employer(employer_id) on delete set null
)
;
insert into employer values (1)
;
insert into employee values (1, 1)
;
delete employer
;
select * from employee
;
drop table employee purge
;
drop table employer purge
;

Table EMPLOYER created.
Table EMPLOYEE created.
1 row inserted.
1 row inserted.
1 row deleted.

                            EMPLOYEE_ID                             EMPLOYER_ID
--------------------------------------- ---------------------------------------
                                      1                                       

Table EMPLOYEE dropped.
Table EMPLOYER dropped.

Tags: Database

Similar Questions

  • Parsing sql - cursor parent and child

    Hi all

    What is the parent and child when parsing sql cursor?

    Thank you

    John

    Well, as Anand mentioned you could yourself. Here's a demo of the workaround based. Based on the change of environment, the sliders would be created and will not be shared that I made using the change of parameter of optimizer_mode. This is done in 11201 with the setting optimizer_features_enable on 10201.

    SQL> drop table t purge;
    
    Table dropped.
    
    SQL> select sql_text from V$sqlarea where sql_text like 'select * from t%';
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    select * from t
    
    SQL> alter system flush shared_pool;
    
    System altered.
    
    SQL> select sql_text from V$sqlarea where sql_text like 'select * from t%';
    
    no rows selected
    
    SQL> save a
    Created file a.sql
    SQL> select * from t;
    select * from t
                  *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    
    SQL> create table t(a char);
    
    Table created.
    
    SQL> select * from t;
    
    no rows selected
    
    SQL> select sql_text from V$sqlarea where sql_text like 'select * from t%';
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    select * from t
    
    SQL> select * from T;
    
    no rows selected
    
    SQL> select sql_text from V$sqlarea where sql_text like 'select * from t%';
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    select * from t
    
    SQL> select sql_text from V$sqlarea where sql_text like 'select * from t%' or sql_text like 'select * from T%';
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    select * from t
    select * from T
    
    SQL> select sql_text,version_count, executions from V$sqlarea where sql_text like 'select * from t%' or sql_text like 'select * from T%';
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    VERSION_COUNT EXECUTIONS
    ------------- ----------
    select * from t
                1          1
    
    select * from T
                1          1
    
    SQL> column sql_text format a40
    SQL> /
    
    SQL_TEXT                                 VERSION_COUNT EXECUTIONS
    ---------------------------------------- ------------- ----------
    select * from t                                      1          1
    select * from T                                      1          1
    
    SQL> select * from T;
    
    no rows selected
    
    SQL> select sql_text from V$sqlarea where sql_text like 'select * from t%' or sql_text like 'select * from T%';
    
    SQL_TEXT
    ----------------------------------------
    select * from t
    select * from T
    
    SQL> select sql_text,version_count, executions from V$sqlarea where sql_text like 'select * from t%' or sql_text like 'select * from T%';
    
    SQL_TEXT                                 VERSION_COUNT EXECUTIONS
    ---------------------------------------- ------------- ----------
    select * from t                                      1          1
    select * from T                                      1          2
    
    SQL> alter session set optimizer_mode=first_rows;
    
    Session altered.
    
    SQL> select * from T;
    
    no rows selected
    
    SQL> select * from t;
    
    no rows selected
    
    SQL> select sql_text,version_count, executions from V$sqlarea where sql_text like 'select * from t%' or sql_text like 'select * from T%';
    
    SQL_TEXT                                 VERSION_COUNT EXECUTIONS
    ---------------------------------------- ------------- ----------
    select * from t                                      1          1
    select * from test_sharing where id=:a               1          3
    select * from test_sharing where id=1                1          0
    select * from test_sharing where id=99               1          0
    select * from T                                      2          3
    
    SQL> select sql_text, child_number, optimizer_mode, plan_hash_value from V$sql where sql_text like 'select * from t%' or sql_text like 'select * fro
    
    SQL_TEXT                                 CHILD_NUMBER OPTIMIZER_ PLAN_HASH_VALUE
    ---------------------------------------- ------------ ---------- ---------------
    select * from t                                     0 FIRST_ROWS      1601196873
    select * from test_sharing where id=:a              0 ALL_ROWS        3492249339
    select * from test_sharing where id=1               0 ALL_ROWS        3492249339
    select * from test_sharing where id=99              0 ALL_ROWS        2354865636
    select * from T                                     0 ALL_ROWS        1601196873
    select * from T                                     1 FIRST_ROWS      1601196873
    
    6 rows selected.
    
    SQL> alter session set optimizer_mode=first_rows_1;
    
    Session altered.
    
    SQL> select * from t;
    
    no rows selected
    
    SQL> select * from T;
    
    no rows selected
    
    SQL> select sql_text, child_number, optimizer_mode, plan_hash_value from V$sql where sql_text like 'select * from t%' or sql_text like 'select * fro
    
    SQL_TEXT                                 CHILD_NUMBER OPTIMIZER_ PLAN_HASH_VALUE
    ---------------------------------------- ------------ ---------- ---------------
    select * from t                                     0 FIRST_ROWS      1601196873
    select * from test_sharing where id=:a              0 ALL_ROWS        3492249339
    select * from test_sharing where id=1               0 ALL_ROWS        3492249339
    select * from test_sharing where id=99              0 ALL_ROWS        2354865636
    select * from T                                     0 ALL_ROWS        1601196873
    select * from T                                     1 FIRST_ROWS      1601196873
    
    6 rows selected.
    
    SQL> alter session set sql_trace=true;
    
    Session altered.
    
    SQL> alter session set optimizer_mode=first_rows_1;
    
    Session altered.
    
    SQL> select * from t;
    
    no rows selected
    
    SQL> select * from T;
    
    no rows selected
    
    SQL> select sql_text,version_count, executions from V$sqlarea where sql_text like 'select * from t%' or sql_text like 'select * from T%';
    
    SQL_TEXT                                 VERSION_COUNT EXECUTIONS
    ---------------------------------------- ------------- ----------
    select * from t                                      2          3
    select * from test_sharing where id=:a               1          3
    select * from test_sharing where id=1                1          0
    select * from test_sharing where id=99               1          0
    select * from T                                      3          5
    
    SQL> select sql_text, child_number, optimizer_mode, plan_hash_value from V$sql where sql_text like 'select * from t%' or sql_text like 'select * fro
    
    SQL_TEXT                                 CHILD_NUMBER OPTIMIZER_ PLAN_HASH_VALUE
    ---------------------------------------- ------------ ---------- ---------------
    select * from t                                     0 FIRST_ROWS      1601196873
    select * from t                                     1 FIRST_ROWS      1601196873
    select * from test_sharing where id=:a              0 ALL_ROWS        3492249339
    select * from test_sharing where id=1               0 ALL_ROWS        3492249339
    select * from test_sharing where id=99              0 ALL_ROWS        2354865636
    select * from T                                     0 ALL_ROWS        1601196873
    select * from T                                     1 FIRST_ROWS      1601196873
    select * from T                                     2 FIRST_ROWS      1601196873
    
    8 rows selected.
    
    SQL> select sql_id,sql_text, child_number, optimizer_mode, plan_hash_value from V$sql where sql_text like 'select * from t%' or sql_text like 'selec
    
    SQL_ID        SQL_TEXT                                 CHILD_NUMBER OPTIMIZER_
    ------------- ---------------------------------------- ------------ ----------
    PLAN_HASH_VALUE
    ---------------
    89km4qj1thh13 select * from t                                     0 FIRST_ROWS
         1601196873
    
    89km4qj1thh13 select * from t                                     1 FIRST_ROWS
         1601196873
    
    7gbgb5nzcdcf3 select * from test_sharing where id=:a              0 ALL_ROWS
         3492249339
    
    SQL_ID        SQL_TEXT                                 CHILD_NUMBER OPTIMIZER_
    ------------- ---------------------------------------- ------------ ----------
    PLAN_HASH_VALUE
    ---------------
    0890tcnrf5jsv select * from test_sharing where id=1               0 ALL_ROWS
         3492249339
    
    7hg3cujy0ya0r select * from test_sharing where id=99              0 ALL_ROWS
         2354865636
    
    ahgbnyrbh7bp1 select * from T                                     0 ALL_ROWS
         1601196873
    
    SQL_ID        SQL_TEXT                                 CHILD_NUMBER OPTIMIZER_
    ------------- ---------------------------------------- ------------ ----------
    PLAN_HASH_VALUE
    ---------------
    ahgbnyrbh7bp1 select * from T                                     1 FIRST_ROWS
         1601196873
    
    ahgbnyrbh7bp1 select * from T                                     2 FIRST_ROWS
         1601196873
    
    8 rows selected.
    
    SQL> set pagesize 9999
    SQL> /
    
    SQL_ID        SQL_TEXT                                 CHILD_NUMBER OPTIMIZER_
    ------------- ---------------------------------------- ------------ ----------
    PLAN_HASH_VALUE
    ---------------
    89km4qj1thh13 select * from t                                     0 FIRST_ROWS
         1601196873
    
    89km4qj1thh13 select * from t                                     1 FIRST_ROWS
         1601196873
    
    7gbgb5nzcdcf3 select * from test_sharing where id=:a              0 ALL_ROWS
         3492249339
    
    0890tcnrf5jsv select * from test_sharing where id=1               0 ALL_ROWS
         3492249339
    
    7hg3cujy0ya0r select * from test_sharing where id=99              0 ALL_ROWS
         2354865636
    
    ahgbnyrbh7bp1 select * from T                                     0 ALL_ROWS
         1601196873
    
    ahgbnyrbh7bp1 select * from T                                     1 FIRST_ROWS
         1601196873
    
    ahgbnyrbh7bp1 select * from T                                     2 FIRST_ROWS
         1601196873
    
    8 rows selected.
    
    SQL> set linesize 200
    SQL> /
    
    SQL_ID        SQL_TEXT                                 CHILD_NUMBER OPTIMIZER_ PLAN_HASH_VALUE
    ------------- ---------------------------------------- ------------ ---------- ---------------
    89km4qj1thh13 select * from t                                     0 FIRST_ROWS      1601196873
    89km4qj1thh13 select * from t                                     1 FIRST_ROWS      1601196873
    7gbgb5nzcdcf3 select * from test_sharing where id=:a              0 ALL_ROWS        3492249339
    0890tcnrf5jsv select * from test_sharing where id=1               0 ALL_ROWS        3492249339
    7hg3cujy0ya0r select * from test_sharing where id=99              0 ALL_ROWS        2354865636
    ahgbnyrbh7bp1 select * from T                                     0 ALL_ROWS        1601196873
    ahgbnyrbh7bp1 select * from T                                     1 FIRST_ROWS      1601196873
    ahgbnyrbh7bp1 select * from T                                     2 FIRST_ROWS      1601196873
    
    8 rows selected.
    
    SQL> select child_number, child_address, stats_row_mismatch, optimizer_mode_mismatch
      2  from v$sql_shared_cursor where sql_id='ahgbnyrbh7bp1';
    
    CHILD_NUMBER CHILD_AD S O
    ------------ -------- - -
               0 1A610050 N N
               1 1F148DA4 N Y
               2 1A630C90 Y N
    
    SQL>
    

    You can see an inconsistency in the optimizer_mode resulting in another creation of child cursor. You can try to use the parameter cursor_sharing similar value and bind variables that would also cause child several sliders to create. For the view V$ sql_shared_cursor, check the docs.

    HTH
    Aman...

    PS: Please don't bump up to the thread. This is not support so people are not forced to update immediately. All are volunteers so assume that they would update the thread as and when they have / get time to do.

  • Cursors for parent and child, bind variable and library cache

    I was going through the documentation to understand the difference between the parent and the child cursors. Surprisingly, there's not too much help for this. I was able to collect the following information about this

    For each statement SQL cache library contains a cursor "parent" for the text of the SQL statement. The parent cursor is composed of a "handle" that can be searched by the hash value via the library cache hash table and an «object' which contains pointers to each of its «child» cursors Each cursor of the child is also composed of a handle and an object. The child object is composed of two segments numbered from 0 to 6. Lot 0 contains all the credentials for a particular version of the SQL statement and lot 6 contains the execution plan. This distinction between parent and child cursors is maintained even when there is only one version of each SQL statement.

    Lets say that 2 LMD were fired with the same set of variables bind (names of variables were same but differed from the value.) The only difference between the 2 LMD was the value of the variable binding) and under the same conditions of load.

    These DML 2 would be a sliders 2 children of one parent only cursors.

    Please tell me detailed documentation on the subject, so my question is too elementary

    Kind regards
    Vishal

    I'm not sure how useful jumping in stuff like bunch 0 and 6 bunch is in terms of understanding what is a parent and what is a child cursor.
    This quote seems to come from Steve Adams - http://www.ixora.com.au/q+a/0104/19005414.htm
    It's a good idea to cite your references.

    I'll give it a go.

    A cursor is a lot of information stored in memory on a SQL statement.

    The basic information for a parent cursor is the text of the SQL statement - exact matches of the statement can only share the parent cursor.

    The cursor of the child is really on the implementation plan specific for a statement and the different settings and parameters that caused this plan to be generated.

    There are a whole bunch of reasons why the executions of the same SQL statement may or may not reuse the existing child cursors.

    In your example 2 statements that differ by the variable binding are likely to lead to different children, although there are factors that can lead to lie different values, do not share the same children among whom for example, the length of the dregs, Adaptive setting cursor_sharing = similar and histograms, or new features like cursor sharing (on subsequent runs of renowned sql running suboptimal initially).

    It might be useful to see V$ SQL_SHARED_CURSOR. This shows the disparities that cause children to not be shared. There are more than 60 columns in this view which gives an indication of the number of factors that can influence.
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17110/dynviews_3059.htm#REFRN30254

    You might want to look here the criteria for sharing SQL:
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e16638/memory.htm#i40017

    Away from the main documentation, perhaps some of the writings of the optimizer Development Group could help?
    http://blogs.Oracle.com/mt/mt-search.cgi?blog_id=3361&tag=cursor%20sharing&limit=20

    Christian Antognini described this area very well in the "Oracle Performance Troubleshooting Guide".

    Published by: Dom Brooks on February 24, 2011 16:45

  • How is a parent and child, rights and roll determind in the script

    How is a parent and child, rights and roll determind in the script as an exe of java or xml. It's first and second user and which assings these rolls? thanx

    Hello

    Thanks for posting your question in the Microsoft Community.

    Sinc you want to determine the parent and the child rights usings script as an exe of java or xml, the question you posted would be best suited in the MSDN Forums. I would recommend posting your query in the MSDN Forums for further assistance:

    MSDN forums

  • Is it possible to insert a video and have it automatically play when the topic is open?

    I use Robohelp 10. Is it possible to insert a video and have it automatically play when the topic is open?

    Not to worry - found the autostart definition in html code and it changed.

  • Why Developer SQL displays arrows (relations) between parent and child tables in my entity relationship diagram?

    Hello


    Oracle version:                     Oracle Database 11 g Release 11.1.0.7.0 - 64 bit Production

    The version of SQL Developer: 4.0.2.15 - 15.21 build

    I have a question about drawing diagram, entity-relationship with SQL Developer & I would be grateful if you could kindly give me a helping hand.

    I would like to draw an entity-relationship diagram in order to better visualize the relationship between multiple tables. After a google search, I found the following interesting article indicating the procedure to be followed:

    http://www.Oracle.com/technetwork/issue-archive/2014/14-may/o34sqldev-2193423.html

    (What I need and I'm trying to produce is Figure 4 in the article above)

    I made exactly as stated in the article & apparently everything has worked well enough, in other words, I had several UML as rectangles showing columns of tables, their data types, primary and
    foreign key and the arrows indicating the link between each parent/child table.

    Later, I tried to do the same thing on a different oracle instance and a different database by using the same procedure. Yet, something strange happened this time. Developer SQL printed on-screen tables, once again,.
    inside the rectangles with types, keys,... but, there was no arrow showing the link between the tables, I just saw on the grid the selected tables but without any association/relationship shown (as a symbol of an arrow)
    between them.

    I repeated the procedure on another instance of development, with a few test tables that I created with primary and foreign keys just to make sure I had followed the procedure correctly. Once again

    the test was successful, but when I repeated the test on another instance, the same problem persisted, in other words, no arrow (relationship) between tables.

    Any idea?

    This could be due to a lack of privilege on the instance? If Yes, what should be granted in what about roles?

    Thanks in advance

    I think that what you see is that not all databases have foreign keys - applications hard-coding relationships vs let the database to handle this.

    Connect to this instance different oracle and browse the tables affected - have FK constraints defined on them?

  • Delete records parent and child

    Hi all, hope you can help. I was wondering what the most effective method is to do this:

    There are 3 tables involved.

    TBL_APPLICATION (appl_no (PK))
    TBL_ROOM (appl_no (FK))
    TBL_ROOM_MATE (appl_no (FK))

    TBL_APPLICATION is the main table and has a 1 to many times TBL_ROOM & TBL_ROOM_MATE relationship.


    I have 80 files or that I need to remove TBL_APPLICATION and atomically delete their child references in the TBL_ROOM & TBL_ROOM_MATE as well.

    I looked at a procedure that allows you to select each app_no and removes references to the child first and then countering to TBL_APPLICATION.

    Some tips and examples would be much appreciated, as it is important I don't mess this place and I want to keep each atomic transaction incase something breaks down. : D

    Thank you very much

    oraCraft wrote:
    Arrays do not have the Delete Cascade game, nor can I change the table. So I can't use it. I will implement the procedure.

    Tubby if I had to create a cursor and loops on each App_no running the three remove commands, is completely Atomic? as he used complete unless all orders delete three are made to the database. ? Also will I commit in the loop or outside it?

    Do not use a loop, all that will do is to add massive amounts of overhead to the procedure.

    Perform deletions as I pointed out, this is your best bet.

    Regarding the commitment, which is really for you. Generally, you should not be committed in your routines, that should be the responsibility of the calling application so that it can determine the transaction limits.

    If you have added a validation of the code, you would add a commit only after the statement of final deletion, which would preserve the integrity of the transaction in this procedure, but again, adding a commit procedure means you have mandated that a transaction includes, who can not fly with applications by calling the procedure.

  • composite unique constraint on the values of parent and child?

    Is it possible to have a composite unique constraint that contains the values of the child elements? The example below has the "child" elements are offline, but it's preferred, but optional, I know that you can have a unique constraint in the set of tables without using a reference table that contains the constraint and the two columns. How xdb manages this requirement?

    permit:
    <parent ID="1">
       <child><name>test1</name></child>
       <child><name>test2</name></child>
    </parent>
    <parent ID="2">
       <child><name>test1</name></child>
       <child><name>test2</name></child>
    </parent>
    not allowed:
    <parent ID="1">
       <child><name>test1</name></child>
       <child><name>test1</name></child>
    </parent>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
               xmlns:xdb="http://xmlns.oracle.com/xdb"
               xdb:storeVarrayAsTable="true"
               elementFormDefault="qualified">
        
        <xs:element name="parent" type="Parent_T"
            xdb:columnProps="CONSTRAINT parent_pkey PRIMARY KEY (XMLDATA.ID)"
            xdb:defaultTable="PARENT"/>
    
        <xs:complexType name="Parent_T" xdb:SQLType="PARENT_T" xdb:maintainDOM="false">
            <xs:sequence>
                <xs:element name="child" type="Child_T" minOccurs="1" maxOccurs="unbounded" xdb:SQLName="CHILD"
                          xdb:SQLInline="false" xdb:defaultTable="CHILD" "/>
            </xs:sequence>
            <xs:attribute name="ID" xdb:SQLName="ID" use="required" />
        </xs:complexType>
        
        <xs:complexType name="Child_T" xdb:SQLType="CHILD_T">
           <xs:sequence>
             <xs:element name="name" type="xs:string" xdb:SQLName="NAME"/>
           </xs:sequence>
         </xs:complexType>     
    </xs:schema>
    xdb:columnProps = "CONSTRAINT parent_pkey PRIMARY KEY (XMLDATA.ID), * UNIQUE (XMLDATA.» "Child.Name) *" triggers the non-existent attribute


    A possible solution would be to copy the value of the primary key parent of the child element, then I could create a composite unique constraint using only the values of the child. However, I have this same requirement elsewhere in my lowest nested schema, and it can become messy / bad design with cascading of all primary keys on the schema. For example, I have a recursive element in which two attributes must be unique only within the parent company:
    <parent id="1">
       <child a="1" b="1">
          <child a="1" b="2">
             <child a="1" b="1" /> *not allowed
          </child>
       </child>
       <child a="1" b="2" /> *not allowed
    </parent>
    Possible solution:
    <child a="1" b="2" parent_id="1" />
    <xs:complexType name="Child_T>
       <xs:sequence>
          <xs:element name="child" xsd:SQLInline="false" xsd:columnProps="UNIQUE(XMLDATA.a,XMLDATA.b,XMLDATA.parent_id)" minOccurs="0" maxOccurs="unbounded" type="Child_T">
       </xs:sequence>
       </xs:element
    </xs:complexType>
    Is there a better design?

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi 
    PL/SQL Release 10.2.0.4.0 - Production                           
    CORE     10.2.0.4.0     Production                                       
    TNS for Linux: Version 10.2.0.4.0 - Production                   
    NLSRTL Version 10.2.0.4.0 - Production 

    You can do something like this:

    SQL> DECLARE
      2
      3    xsd_doc xmltype := xmltype('
      4  
      5    
      6      
      7        
      8          
      9        
     10      
     11    
     12    
     13      
     14        
     15          
     16        
     17      
     18    
     19    
     20      
     21        
     22          
     23        
     24        
     25      
     26    
     27    
     28      
     29        
     30          
     31        
     32      
     33    
     34  ');
     35
     36  BEGIN
     37
     38    dbms_xmlschema.registerSchema(
     39      schemaURL => 'test_parent.xsd',
     40      schemaDoc => xsd_doc,
     41      local => true,
     42      genTypes => true,
     43      genbean => false,
     44      genTables => false,
     45      enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
     46    );
     47
     48  END;
     49  /
    
    PL/SQL procedure successfully completed
    
    SQL> CREATE TABLE my_xml_table OF XMLTYPE
      2  XMLTYPE STORE AS OBJECT RELATIONAL
      3  XMLSCHEMA "test_parent.xsd"
      4  ELEMENT "root"
      5  VARRAY xmldata."parent" STORE AS TABLE my_parent_tab
      6  (
      7    VARRAY "child" STORE AS TABLE my_child_tab
      8  )
      9  ;
    
    Table created
    
    SQL> ALTER TABLE my_parent_tab ADD CONSTRAINT parent_uk UNIQUE (nested_table_id, "ID");
    
    Table altered
    
    SQL> ALTER TABLE my_child_tab ADD CONSTRAINT child_uk UNIQUE (nested_table_id, "name");
    
    Table altered
     
    

    Then:

    SQL> insert into my_xml_table values (
      2  xmltype('
      3     test1
      4     test2
      5  
      6  
      7     test1
      8     test2
      9  ')
     10  );
    insert into my_xml_table values (
    *
    ERREUR à la ligne 1 :
    ORA-00001: violation de contrainte unique (DEV.PARENT_UK)
    
    SQL> insert into my_xml_table values (
      2  xmltype('
      3     test1
      4     test1
      5  
      6  
      7     test1
      8     test2
      9  ')
     10  );
    insert into my_xml_table values (
    *
    ERREUR à la ligne 1 :
    ORA-00001: violation de contrainte unique (DEV.CHILD_UK)
    
    SQL> insert into my_xml_table values (
      2  xmltype('
      3     test1
      4     test2
      5  
      6  
      7     test1
      8     test2
      9  ')
     10  );
    
    1 ligne créée.
    

    http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14259/xdb06stt.htm#sthref987

  • Look for the same combination of parent and child

    Hi all I am using oracle 10g. can you please help me in this issue.
    How can I know if the same combination of filiation in the table

    key to value and value are values given by the user.
    If the user tries to create a profile even with the same set of key_value and value while avoid
    So how do you achieve this.


    Profile example already in the table
    ----------------------------------------------------------------------
    -- PROFILE_ID,DETAIL_ID,PARENT_DETAIL_ID,KEY_VALUE, VALUE, LAST_IND
    100,               1,               NULL,                      1,              CDE,     N
    100,               2,              1,                            2,              XXX,     N
    100,               3,              1,                            2,              YYY,    N
    100,               4,              1,                            4,              NEW,    Y
    new user profile - it should raise an error saying that same profile already present
    -- PROFILE_ID,DETAIL_ID,PARENT_DETAIL_ID,KEY_VALUE,VALUE,LAST_IND
    101,               5,               NULL,                      1,              CDE,    N
    101,               6,              5,                            2,              XXX,    N
    101,               7,              5,                            2,              YYY,    N
    101,               8,              5,                            4,              NEW,    Y
    Published by: DeepakDevarapalli on December 9, 2009 09:48

    Published by: DeepakDevarapalli on December 9, 2009 09:59

    Hello

    Rather than separate subqueries to get target_ptxt and staging_ptxt, it is easier to combine the target and the staging in a UNION, then calculate the ptxt once, unified data. To mark the staging data, I assigned profile - 1, assuming it wasn't a number real profile.

    The following query calculates ptxt for each profile, including the profile =-1 (staging).
    It then compares the ptxt transit zone to all other ptxts and identifies each one that matches.
    If the query does not have all the lines, then staging did not match any profile existing in tagrget.

    WITH       union_data     AS
    (
         SELECT     profile
         ,     key
         ,     value
         FROM     target
              --
         UNION ALL
                 --
         SELECT     -1     AS profile
         ,     key
         ,     value
         FROM     staging
    )
    ,     got_r    AS
    (
         SELECT       profile
         ,       key || '/' || value               AS rtxt
         ,       ROW_NUMBER () OVER ( PARTITION BY  profile
                                      ORDER BY         key
                               ,              value
                             )                      AS rnum
         FROM       union_data
    )
    ,     got_p     AS
    (
         SELECT     profile
         ,     SYS_CONNECT_BY_PATH (rtxt, ',')     AS ptxt
         FROM     got_r
         WHERE       CONNECT_BY_ISLEAF     = 1
         START WITH     rnum          = 1
         CONNECT BY     rnum          = PRIOR rnum + 1
              AND     profile          = PRIOR profile
    )
    SELECT    'Profile Already Present'     AS warning
    ,       t.profile
    FROM       got_p          s
    JOIN       got_p          t     ON     s.ptxt     = t.ptxt
    WHERE       s.profile     =  -1
    AND       t.profile     != -1
    ;
    
  • Need help with a self-join select the parent and child

    Hi all

    I have an OFFICE table that will hold the Oncology, district and division of the hierarchic is Oncology-district-> division >

    I want to list Oncology, district and division with its parent of the value of the following
    provinc     district      division
    
    A            NULL       NULL
    A            A.A         NULL
    A            A.A         A.A.A 
    -- Create table
    CREATE TABLE OFFICE
    (
      SLNO         VARCHAR2(20 BYTE),
      OFFICE_NAME  VARCHAR2(20 BYTE),
      PARENT_SLNO  VARCHAR2(20 BYTE),
      TYPE         VARCHAR2(2 BYTE)
    );
    
    ALTER TABLE OFFICE ADD (
      CONSTRAINT OFFICE_PK
      PRIMARY KEY
      (SLNO)
     );
    
    ALTER TABLE OFFICE ADD (
      CONSTRAINT P_C_FK 
      FOREIGN KEY (PARENT_SLNO) 
      REFERENCES OFFICE (SLNO));
    
    
    INSERT INTO OFFICE
      (SLNO, OFFICE_NAME, PARENT_SLNO, TYPE)
    VALUES
      ('1', 'A', NULL, 'PR');
    INSERT INTO OFFICE
      (SLNO, OFFICE_NAME, PARENT_SLNO, TYPE)
    VALUES
      ('2', 'A.A','1', 'DT');  
    INSERT INTO OFFICE
      (SLNO, OFFICE_NAME, PARENT_SLNO, TYPE)
    VALUES
      ('3', 'A.A.A', '2', 'DV');  
    I need your help.
    Thank you.

    Published by: Dipabkar Banik (DB) on June 13, 2011 12:17 AM

    Published by: Dipabkar Banik (DB) on June 13, 2011 12:18 AM

    Published by: Dipabkar Banik (DB) on June 13, 2011 06:45

    Published by: Dipabkar Banik (DB) on June 13, 2011 06:47

    Try this

    SELECT   CONNECT_BY_ROOT (office_name) provinc,
                 DECODE (LEVEL, 2, office_name, PRIOR office_name) district,
                 DECODE (LEVEL, 3, office_name) division
          FROM   office
    CONNECT BY   PRIOR slno = parent_slno
    START WITH   parent_slno IS NULL
    
  • How the data automatically appear in the text element.

    Hi all
    I m using oracle 10g forms and reports on win xp.
    I have a table named "Estimate" that have the following fields: -.

    (1) Object_Name
    (2) Object_Code
    (3) Budget_Estimate
    (4) Add_Fund

    For Object_Name I have create the item list, I have 51 articles in this element of the list. When I press 'A', it shows me everything starts from "A".
    and it's the same for other alphabets.

    My problem is when I press 'A' in and select my specific name of the object and enter after that I got the specific object for the name of the object Code.
    For example, I have these names of objects and their Codes: -.

    Object_name Object_Code

    Pay 01
    Allocation 02
    Medical allowance 03
    Convince 04
    House rent 05

    Now, when I select the Object_Name Pay and press on enter, automatically appear 01 danslechamp Object_Code,.
    even that is, when I select rent house break-in, then in Object_Code filed appears 05.

    Concerning

    Sidibé

    Oh yes execuse me :)

    If I have your right point...

    Trigger WHEN-LIST-CHANGED

    SELECT Object_CODE
    
    INTO :NON_DB_TEXT_ITEM -- or a text_item
    
    FROM TABLE_NAME
    
    WHERE Object_Name = :Object_Name;
    
    -- Then Assign :NON_DB_TEXT_ITEM to a text_item in when-validate Trigger
    
    :TEXT_ITEM := :NON_DB_TEXT_ITEM;
    
    or u can assign the list value to a text item
    
     :text_item = :Object_Name;
    

    It could be that useful...

    Kind regards

    Abdetu...

    Published by: Abdetu on February 16, 2011 09:09

  • Clip of Label and name not automatically update in the timeline panel

    I just finished a major project, so now that he has the time to take the plunge and upgrade first. So far, it's fine, but the clip labels and names only are not automatically updated in the timeline panel when I change into the bin. Is this something that only works on new projects (rather than old projects updated in this new version)? Or...?

    Go to the menu file > Project Settings > general, and when the component of the project opens, check the box 'display name of project items and label color for all instances.

    MtD

  • How to delete records parent and child together?

    Hello

    I use Jdeveloper 11.1.2.2
    I want to delete a row in a table, but it is to show:
     Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (TABLE1_TL_FK1) violated - child record found.
    So, how can I remove a child line and the line of the table in a method?

    I can't access the child VO because it is not added to the AM.

    Thank you

    Nigel.

    http://docs.Oracle.com/CD/E26098_01/Web.1112/e16182/bcentities.htm#BABHFJFJ

  • Parental and child control with AS3

    Hello

    I am new to AS3 and although I can see some good practices and functionality, I'm constantly stuck and can still do the things I would do if easily with AS2 - I almost it relearn from scratch!. I would still appreciate little help and advice on this...

    I did a class that creates a "sort" menu with data from an XML file, and basically is what he does when he is called to create an emptyMC (a container), add a childMC (a square) and add another child (a text label). When I create the container, I am trying to add a MouseEvent that can act on each instance of container, but all I can get is a MouseEvent on the object that contains all the MCs added. The code follows.

    Can someone enlight me with that issue or explain what I am doing wrong.

    I do not understand the parental dynamics with AS3 and the absence of the use of instance names and parenting dot does not help.

    Thanks in advance.

    Note to Adobe: previous versions of Flash and as a reference Help files were far more useful than in CS4!

    In the timeline:

    Import assets.myDynMenu;

    var theMenu:myDynMenu = new myDynMenu ("menu.xml");
    stage.addChild (theMenu)

    Stop();

    In the class:

    package assets

    {

    import flash.display. *;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    flash.net import. *;

    public class myDynMenu extends Sprite {}

    LOADING EXTERNAL INIT DATA

    public void myDynMenu (theData) {}

    LOADS MENU DATA FROM PREFORMATTED XML
    var loader: URLLoader = new URLLoader();
    var url: URLRequest = new URLRequest (theData);
    loader.addEventListener (Event.COMPLETE, buildTheMenu);
    Loader.Load (URL);
    }

    FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN

    public void buildTheMenu(event:Event):void {}

    var xml = new XML (event.target.data);

    for (var i = 0; I < xml.menuData.menuItem.length (); i ++) {}

    ADDS A CONTAINER

    var itemContainer:MovieClip = new MovieClip();
    itemContainer.name = "menu" + i;
    //

    THE NEXT LINE IS NOT DO WHAT I WANTED?
    IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDREN

    itemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    //

    itemContainer.x = 100 * i;
    itemContainer.y = 0;
    itemContainer.mouseEnabled = true;
    itemContainer.mouseChildren = false;
    addChild (itemContainer);

    ADDS A CHILD OF CONTAINER (a square)

    var itemBase:MovieClip = new MovieClip();
    itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
    itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mConfig.mainIt emH);
    itemBase.graphics.endFill ();
    itemBase.name = "basic" + i;
    itemBase.mouseEnabled = false;
    itemBase.mouseChildren = false;
    itemContainer.addChild (itemBase);

    ADDS a CHILD OTHER to CONTAINER (a text label)

    var theLabel:TextField = new TextField();
    theLabel.x = 5;
    theLabel.y = 5;
    theLabel.selectable = false;
    theLabel.mouseEnabled = false;
    theLabel.border = true;
    theLabel.text = xml.menuData.menuItem [i] .mName;
    itemContainer.addChild (theLabel);

    }

    }

    It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
    private void onMouseOver(event:MouseEvent):void {}

    event.stopPropagation ();
    trace ("you're on" + myIdName);
    }


    }

    }

    use:

    package assets

    {

    import flash.display. *;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    flash.net import. *;

    public class myDynMenu extends Sprite {}

    LOADING EXTERNAL INIT DATA

    public void myDynMenu (theData) {}

    LOADS MENU DATA FROM PREFORMATTED XML


    var loader: URLLoader = new URLLoader();
    var url: URLRequest = new URLRequest (theData);
    loader.addEventListener (Event.COMPLETE, buildTheMenu);
    Loader.Load (URL);
    }

    FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN

    public void buildTheMenu(event:Event):void {}

    var xml = new XML (event.target.data);

    for (var i = 0; i)

    ADDS A CONTAINER

    var itemContainer:MovieClip = new MovieClip();
    itemContainer.name = "menu" + i;
    //

    THE NEXT LINE IS NOT DO WHAT I WANTED?
    IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDREN

    itemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    //

    itemContainer.x = 100 * i;
    itemContainer.y = 0;
    itemContainer.mouseEnabled = true;
    itemContainer.mouseChildren = false;
    addChild (itemContainer);

    ADDS A CHILD OF CONTAINER (a square)

    var itemBase:MovieClip = new MovieClip();
    itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
    itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mCon fig.mainItemH);
    itemBase.graphics.endFill ();
    itemBase.name = "basic" + i;
    itemBase.mouseEnabled = false;
    itemBase.mouseChildren = false;
    itemContainer.addChild (itemBase);

    ADDS a CHILD OTHER to CONTAINER (a text label)

    var theLabel:TextField = new TextField();
    theLabel.x = 5;
    theLabel.y = 5;
    theLabel.selectable = false;
    theLabel.mouseEnabled = false;
    theLabel.border = true;
    theLabel.text = xml.menuData.menuItem [i] .mName;
    itemContainer.addChild (theLabel);

    }
      
    }

    It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
    private void onMouseOver(event:MouseEvent):void {}

    event.stopPropagation ();
             trace ("you're on" + event.currentTarget.name);
    }

    }

    }

  • Problems with the Parent and child Pages...

    I created a parent page with several pages of the child, but when I transferred to my host FTP pages do not come to the top in the hierarchy in the URL bar. I want it to be "www.website.com/parent/child.html" but they come as 'www.website.com/child.html '.

    How can I change this? I thought that by creating a page parent to the child which would automatically when loading pages. Help, please!

    Thank you!!!

    Muse currently publishes all the pages in the root directory of the Web server. It does not create a folder structure based on the structure of the site defined in Plan view. The structure of the site defined in the Plan view is used by the Widget Menu to generate Menus correspondents and submenu entries.

    Hope that specified in the query.

    See you soon,.

    Vikas

Maybe you are looking for