Truncating table throws error although no child record exists

I have 2 tables
table_master (This is master table)
table_child (This is child table)
truncate table table_child ;
the above executes properly
BUT
truncate table table_master;
ERROR at line 1:
ORA-02266: unique/primary keys in table referenced by enabled foreign keys
Although there is no child record even though the above error is occuring.Please sove my problem.

Hi,
>>lthough there is no child record even though the above error is occuring.Please sove my problem.
In fact, doesn't matter if child table contain or not data.
LEGATTI> create table a (id number primary key);
Table created.
LEGATTI> create table b (id number constraint fk_b_a references a);
Table created.
LEGATTI> truncate table a;
truncate table a
ERROR at line 1:
ORA-02266: unique/primary keys in table referenced by enabled foreign keys
LEGATTI> alter table b disable constraint fk_b_a;
Table altered.
LEGATTI> truncate table a;
Table truncated.
-- In addition, in order to drop the parent table, just disable the constraint's child table is not sufficient.
LEGATTI> select constraint_name,status from user_constraints where table_name='B';
CONSTRAINT_NAME                STATUS
FK_B_A                         DISABLED
LEGATTI> drop table a;
drop table a
ERROR at line 1:
ORA-02449: unique/primary keys in table referenced by foreign keys
LEGATTI> drop table a cascade constraints;
Table dropped.
LEGATTI> select * from user_constraints where table_name='B';
no rows selectedCheers
Legatti

Similar Messages

  • Global temp table throwing error

    Hi,
    I am trying to create global temp table throwing error
    please help
    SQL> create global temporary table test_glb as ( select col1 from test1) on commit delete rows;
    create global temporary table test_glb as ( select col1 from test1) on commit delete rows
    ORA-00933: SQL command not properly ended
    Thanks
    Rangan S

    CREATE GLOBAL TEMPORARY TABLE test_glb ON COMMIT DELETE ROWS
    AS SELECT * FROM test1;btw I'm assuming you are just using the SELECT statement to copy the definition of test1. Since DDL statements commit, there will be no rows in test_glb after creating it.
    Edited by: William Robertson on Feb 23, 2009 7:31 AM

  • APP-PAY-07201 Cannot perform a delete when child record exists in future

    I am trying to put end date to a payment method of any employee in HR/Payroll 11.5.10.2
    but receiving the following error message:
    APP-PAY-07201 Cannot perform a delete when child record exists in future
    Can u advise what steps I should follow to resolve this issue.
    Regards /Ali

    This note is related to termination of employee while our employee is on payroll and just want to change is payment method. But in the presence of existing payment method we cannot attched another becuase we are receiving an error:
    APP-PAY-07041: Priority must be unique within an orgainzational payment method

  • System throwing error " ibase object doesn't exist"

    Dear Friends;
    in the transaction ib52 when im putting the component number and pressing enter the system is showing me the error
    "ibase objec doesn't exist" . Which means system not  allowing to search ibase using the component number.
    Please help.
    shibashish banerjee

    Dear Denis,
    When I'm putting the component and pressing enter the system should automatically display the ibase related to this component right?
    Instead of this the system is throwing me the error " ibase object does'nt exist" . which i feel is incorrect . As per me system should automatically show me ibase , when i enter the component number and press enter.
    I checked in ibib and ibin tables as well. No conclusion.
    Regards
    shibashish banerjee

  • Error-u201CNo customer master record exists with sold to partyu201D. from Webshop

    Hi,
    We are trying to create an order from webshop calling BAPI_SALESORDER_CREATEFROMDAT2, while saving the order we are getting an error that "No customer master record exists with sold to party".
    When we try to execute the same with stanalone program from Java the output is coming fine.
    If anyone worked on similar issue, kindly let me know.
    -Thanks

    Hello Mark,
    Yes, Master data is available in both systems.  Configuration is also fine.
    Thanks,
    Satish.

  • Oracle outer join on  multiple tables throws error

    Hi ,
    We are using ansi joins with outer joins on multiple tables in oracle 9i.
    Now these queries have to be used in Oracle8i.
    Since Oracle8i does not support ansi sql we are replacing the ansi sql queries with the oracle joins.
    On trying the same we found that the following query
    select *from tab1 a, tab2 b, tab3 c where a.c1 = b.col1(+) and c.c2 = b.col2 (+)
    throws the error
    ORA-01417: a table may be outer joined to at most one other table.
    Is there a way to simulate this query without using the outer joins on multiple tables?
    thanks

    Try writing the query in this form:
    select * from
    (select t1.col1, t1.col2
    from schema.table1 t1, schema.table2 t2
    where t1.col1 = t2.col1(+)) t4,
    schema.table3 t3 where t4.col2 = t3.col2(+)
    In the subquery, you will have to list all the columns you want to see, and you will need to provide unique aliases for any columns with duplicate names. I tested this on 9i, and don't have an 8i system to work with, so I hope this helps.

  • Pl/sql block with "insert into" and schema qualified table throws "error"

    Simplified test case:
    Oracle9i EE Release 9.2.0.3.0
    Oracle JDeveloper 9.0.3.2 Build 1145
    create user u1 identified by u1
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u1;
    revoke unlimited tablespace from u1;
    create user u2 identified by u2
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u2;
    revoke unlimited tablespace from u2;
    As user u2:
    create table u2.t
    c1 number
    grant select, update, insert, delete on u2.t to u1;
    As user u1:
    create or replace package test_pkg as
    procedure do_insert (p_in number);
    end;
    create or replace package body test_pkg as
    procedure do_insert (p_in number) is
    begin
    insert into u2.t values (p_in);
    commit;
    end;
    end;
    All of the above works fine using command-line sql*plus, and is clearly a simplified version of the actual code to demonstrate the issue at hand. Using JDeveloper, it complains about 'expected ;' at the 'values' keyword in the insert statement. Removing the schema qualification from the table name allows JDeveloper to not flag the statement as an error, but I do not want to create synonyms (private or public) to point to all the tables in the real packages. Since JDeveloper flags the insert statement as an error, I can not browse the package structure etc, even though it compiles with no problems. What gives?
    Thanks in advance for any suggestions, etc...

    Hi Bryan,
    Thanks for following up on this. I will look for the bug fix to be published.
    - Mark

  • Throwing error when Creating  Info record

    Hai,
    When Creating Info record . I maintained standard Qty, Min qty ,price and Planned dely time .
    It is not saving and there is an error message that "Maintian all entries in Reqt fields" and Cursor is blinking at Planned delytime . and Not saved/
    Can any one solve my issue.
    regards
    Madhav

    Hi madav ,
    create inforecord me11
    vender name
    mat
    purchase org
    plant
    maintain that and enter,
    go to text  maintain, then click on condition hear maintain as per as the  requirement,
    go back
    click on purchase organization data  then save
    u will not get error .
    hope it will help u .
    thanks
    BIswa

  • ORA 2266 -- Drop parent partition with no child records exists

    Hi Team ,
    Here I have a parent partitioned table and child refrenced non-partition table .
    To drop parent partition I am doing
    1)delete from child
    2)delete from parent partition
    3)alter table drop parent partition
    ---and its working fine .
    I am trying to do below which is not working , Could you please guide me why it is not
    1)delete from child
    2)alter table drop parent partition -- throwing below error
    Summarizing ,
    Why I am not able to drop/trunc a parent partition(no corresponding rows exists in child tables) where as able to do after deleting the rows from parent partition .
    From Doc :
    Error: ORA 2266
    Text: table has some unique/primary keys that are referenced by some foreign k
    eys
    Cause: Attempt to drop the table while the table still has some unique/
    primary keys that are referenced by some foreign keys.
    Action: Remove all such references to the keys before dropping the table
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE     11.2.0.2.0     Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    Oracle decides what the rules are & you must conform to them
    bcm@bcm-laptop:~$ oerr ora 2266
    02266, 00000, "unique/primary keys in table referenced by enabled foreign keys"
    // *Cause: An attempt was made to truncate a table with unique or
    //         primary keys referenced by foreign keys enabled in another table.
    //         Other operations not allowed are dropping/truncating a partition of a
    //         partitioned table or an ALTER TABLE EXCHANGE PARTITION.
    // *Action: Before performing the above operations the table, disable the
    //          foreign key constraints in other tables. You can see what
    //          constraints are referencing a table by issuing the following
    //          command:
    //          SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = "tabnam";

  • Sales Order Error No customer master record exists for sold-to party

    Hi,
    I am trying to create a sales order in IDES. Unfortunately it is showing me error: No Customer master exists for sold to party. Now I have already checked my assignments, combined sales area in vor1 and vor2. Checked PDP ( In PDP I have creates partner functions as z2, z5, z6, z7). I have also checked in XD02 and XD03 and in partner function tab it shows as maintained. Please help as I am still not able to create it.

    Dear Phanikumar,
    I am not sure whether we can create a customer for a future date or not.
    I might sound absurd but suggested this solution because I had faced a similar issue while I was working on a remotly supported IDES server which I was using for practice purpose.
    Now the case was that, I had created some customers few days back, lets say on 01.03.2014 and today the administrator of the server changed the date & time of the system from 11.03.2014 to 11.03.2013 bymistake.
    Hence when i was trying to create orders for a customer created on 01.03.2014 i was not able to do so as the system was throwing an error customer does not exist.
    I am sorry if I have suggested something awkward or wrong, intention was to provide a solution.
    Please correct if I have suggested someting wrong.
    Thanks,
    Kishor

  • NI Elvis throwing error 7, NI 488: Non existent board, NI Elvis traditional throwing error 2, NI 488: Write detects no Listeners when attempting to launch labview

    I wrote a program on a laptop in our lab that used both the NI Elvis power supplies and DMM.  On the laptops in the lab, which connected to NI Elvis through a board in the NI-PXIe device the program worked perfectly both as a vi and as an executable.  The program needed to be put on some computers in another lab for student use with a different version of labview, and everything worked except for the variable power supplies.  I activated debugging and it reported Error 7 at New File, NI 488: Non-Existent Board.  After attempting to trouble shoot this and not finding any helpful results I attempted to rewrite the program on the computers directly, since I could only put the program on the computers as an executable since it was written in 8.6 and the computers only have 8.0 and 8.2.  To begin I was going to launch labview from NI Elvis to use one of the example codes as a base for my program.  When attempting to do this I got Error 2 with the possible causes being Labview memory full and NI 488: Write detected no listeners.  My question is are the two errors related, and how can I fix these errors?  All the NI Elvis software is 2.0, the original program was written in Labview 8.6, the computers have Labview 8.0 and 8.2 on them.  The NI Elvis devices are connected directly through the computers, rather than through another device, I'm not sure if this might be causing some obscure hardware issue.

    Hello Chris,
    It looks like this error is associated with not having administrator privileges. Take a look at this other forum post for more information:
    http://forums.ni.com/t5/Academic-Hardware-Products-NI/Error-2-when-starting-LabVIEW-from-ELVIS-Instr...
    If you can log in as an administrator you should be able to avoid getting error 2 when you launch LabVIEW from NI Elvis. Alternatively, you can upgrade to NI-ELVIS 3.0, because the issue is fixed in that version of NI-ELVIS. You can find this by going to ni.com/support and searching for "NI-ELVIS 3.0"
    Colden

  • Query to delete both parent and child record....

    hai.........
    I tried to delete a record from the table.... but i get a error saying 'child record' exist cannot delete record'.... can u plz tell me the query to delete both parent and child record....
    plz help me.....
    anoo...

    Hello,
    Is already answered in {thread:id=824593}. Please mark the question as answered.
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.logica.com/

  • How to update child record when item from parent record changes

    Hi, I have a master and detail form with two regions on the same page.
    Region one references parent record, one of column in the parent record is also in the child record. And is one to many relation
    between parent record and child record. How can I have the column on the child record updated when the column of the parent record is being modified?
    For exemple; Parent record has two columns : ID and Program.
    Child record has Program, goal# and status. I have two pages established, page 27 and page 28.
    Page 27 list out all programs from parent record, by clicking on edit to a program, it braches to page 28 with program listed as editable field in region one, and mulitple records list in region two from the child record with the same program.
    The problem that I am having is once the program in region one got modified using ApplyMRU, the program in child record did not get updated with the new value and therefore those record become orphan records. I need a way to update all current child records with the new program value.
    Thanks in advance for anyone who can hlep out on this problem.
    Julie
    Edited by: JulieHP on May 24, 2012 4:57 PM

    One Idea is
    If possible create a after update database trigger on the parent table to update the relevant child record.
    Next one
    Create a PL/SQL process on the parent page with process sequence next to ApplyMRU, so when the ApplyMRU is seccessfull it goes not to your process where you can have your update statement

  • TRUNCATE TABLE does not work in PL/SQL - Why?

    Hey there!
    Is there any issue with truncate table not working inside an PL/SQL package?
    For example this function:
    PROCEDURE FLUSH_TABLE(vi_table_name VARCHAR2) IS
    vn_table_name VARCHAR2(30);
    BEGIN
    vn_table_name := UPPER(LTRIM(RTRIM(vi_table_name)));
    TRUNCATE TABLE vn_table_name;
    END FLUSH_TABLE;
    returns the following error msg:
    Error: PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:
    := . ( @ % ;
    The symbol ":= was inserted before "TABLE" to continue.
    Line: 5926
    Text: TRUNCATE TABLE VN_TABLE_NAME;
    Can somebody explain me the problem here? In my point of view, the error msg is not quite right ;)
    Regards,
    Thomas

    > I just think the error msg is confusing
    When you looked for TRUNCATE in the PL/SQL reference you might have noticed that the PL/SQL language has no TRUNCATE keyword. The error message indicates that syntactically the code appears to be some sort of variable assignment but has an extra keyword and no assignment operator. You would get the same message for any similar string of unrecognised keywords:
    SQL> BEGIN
      2      TRUNCATE TABLE emp;
      3  END;
      4  /
        TRUNCATE TABLE emp;
    ERROR at line 2:
    ORA-06550: line 2, column 14:
    PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:
    := . ( @ % ;
    The symbol ":= was inserted before "TABLE" to continue.
    SQL> BEGIN
      2      TRANSMOGRIFY TABLE emp;
      3  END;
      4  /
        TRANSMOGRIFY TABLE emp;
    ERROR at line 2:
    ORA-06550: line 2, column 18:
    PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:
    := . ( @ % ;
    The symbol ":= was inserted before "TABLE" to continue.
    SQL> BEGIN
      2      MORE TEA VICAR; 
      3  END;
      4  /
        MORE TEA VICAR;
    ERROR at line 2:
    ORA-06550: line 2, column 10:
    PLS-00103: Encountered the symbol "TEA" when expecting one of the following:
    := . ( @ % ;

  • How to find child records is exists before to delete parent records.

    Dear Everyone,
    I would like to ask you, is there any simple way to find child records is exists before to delete parent records.
    I have a master table defined primary key and I have referenced that as foreign key in many tables.
    I have used Delete_Record to delete but it isn't display the message 'child record exist' but it cleared the record from the form. So I need to know how to find child records is exists or not before to do delete_record so that I can display message in-case it exists.
    I do know we can able to check in every table matching the column manually, but what if we use 100 of tables then it is not possible to check manually.
    I am sure there must be simple way to find as how the oracle identifies when we execute delete query.
    Please help me on this.
    Thanks in advance.

    Simple solution is to run the query I have given for all child tables or to try a single query for all child tables withj something like:
    select <parent_key>
    from <parent_table>
    where <parent_key> in
              (select <foreign_key_1> from <child_table_1> union
               select <foreign_key_2> from <child_table_2> union
               ... );More complicate solution could be to change the foreign key constraints to cascade DELETE on parent table to child tables:
    SQL>
    SQL> create table p(x int primary key);
    Table created.
    SQL> create table c1(x1 int);
    Table created.
    SQL> create table c2(x2 int);
    Table created.
    SQL>
    SQL> alter table c1 add constraint fk1 foreign key(x1) references p;
    Table altered.
    SQL> alter table c2 add constraint fk2 foreign key (x2) references p;
    Table altered.
    SQL>
    SQL>
    SQL> insert into p values(1);
    1 row created.
    SQL> insert into c1 values(1);
    1 row created.
    SQL> insert into c2 values(1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> alter table c1 drop constraint fk1;
    Table altered.
    SQL> alter table c2 drop constraint fk2;
    Table altered.
    SQL>
    SQL> alter table c1 add constraint fk1 foreign key(x1) references p on delete cascade;
    Table altered.
    SQL> alter table c2 add constraint fk2 foreign key (x2) references p on delete cascade;
    Table altered.
    SQL>
    SQL> delete p where x=1;
    1 row deleted.
    SQL> commit;
    Commit complete.
    SQL> select * from p;
    no rows selected
    SQL> select * from c1;
    no rows selected
    SQL> select * from c2;
    no rows selected
    SQL>Edited by: P. Forstmann on 27 oct. 2011 14:01

Maybe you are looking for

  • Creation of Customer master using CLASS( 'MAINTAIN_BAPI')..

    I am creating customer master by class 'MAINTAIN_BAPI'.  So all fields are sucessfully created except the field 'Remarks / Comments' on customer..Please suggest for the same as far as posiible.. << Moderator message - Everyone's problem is important.

  • Open PO and open PR

    hi frd. help me in this reply. parameter : plant,material no,company code,storage location. display: material no, material desc, UOM, ROL, warehouse, open po, open po qty, open pr no, open pr qty. how to do this guide me in this report. urgent..

  • The host name of macmini-c42c030d62c6.local has changed to macmini-c42c030d62c6.local

    I have received many emails saying: "The host name of macmini-c42c030d62c6.local has changed to macmini-c42c030d62c6.local. Some services may not work correctly until they have been updated to use the new configuration. If I click on macmini-c42c030d

  • Settling of Cost for Production Order via WBS Element

    Hi Gurus, Just would like to briefly understand, how I can make use of the WBS Element in the Production Order (Assignment tab) to use as cost settling for a production order? How do i automate the WBS Element in the production Order for a set of giv

  • Terrence Devlin, can you help?

    Dear Terrence, I am sure that you have an answer to the question about "batch-downsizing" of iPhotos. Contained in " How to "downsize" pix in the iPhoto Library? asked on June 17th. Since I got no responses from the community of my question, I use th