deleting child record that does not exist in tableprocedure parent

IHA

I am in a problem. As I am new on procedure & functions
DECLARE
--v_tablename    VARCHAR(100)          := C_ACCTSCHEMA_DEFAULT;  --- i want use this in the cursor but how?
v_parent_table VARCHAR(100);
v_child_table  VARCHAR(100);

CURSOR FKEY
 IS
           select
                        --  parent.owner        || '.' ||
                        parent.table_name   "parent",
                        --  child.owner         || '.' ||
                        child.table_name    "child"
                 from
                         user_constraints child join user_constraints parent on
                         child.r_constraint_name = parent.constraint_name and
                         child.r_owner           = parent.owner
                where
                         child.table_name like 'C_ACCTSCHEMA_DEFAULT';
BEGIN
delete from vss_insert;
COMMIT;
            for cc in FKEY
       loop
            v_parent_table:=cc.parent;
            v_child_table:=cc.child;
            insert INTO vss_insert
            values(v_parent_table,v_child_table);
            commit;
       end LOOP;
end;
/
error is

ERROR on line 25:
ORA-06550: line 25, column 32:
PLS-00302: component 'PARENT' must be declared.
ORA-06550: line 25, column 13:
PL/SQL: Statement ignored
ORA-06550: line 26, column 31:
PLS-00302: component 'CHILD' must be declared.
ORA-06550: line 26, column 13:
PL/SQL: Statement ignored

How do I solve this problem
DECLARE
      v_tablename    VARCHAR(100) := 'C_ACCTSCHEMA_DEFAULT';
      v_parent_table VARCHAR(100);
      v_child_table  VARCHAR(100);
      CURSOR FKEY
      IS
         SELECT DISTINCT  --  parent.owner        || '.' ||
            p.table_name AS Parent,    ---- parent change to p
         --  child.owner         || '.' ||
            c.table_name AS Child        ---- child change to c
         FROM user_constraints c
          JOIN user_constraints p
            ON c.r_constraint_name = p.constraint_name
            AND c.r_owner          = p.owner
         WHERE c.table_name LIKE '%'||v_tablename||'%';
 BEGIN
   EXECUTE IMMEDIATE 'TRUNCATE TABLE VSS_INSERT';
   -- COMMIT; -- no need commit after truncate
   FOR cc IN FKEY  LOOP
     v_parent_table:=cc.parent;
     v_child_table :=cc.child ;
     INSERT INTO VSS_INSERT VALUES (V_PARENT_TABLE,V_CHILD_TABLE);
     EXECUTE IMMEDIATE 'DELETE FROM ' ||CC.CHILD ||' where '||CC.PARENT||'_id not in (select '||CC.PARENT ||'_id from '||CC.PARENT||')';
   END LOOP;
   commit;
  END;

Tags: Database

Similar Questions

  • How can I delete a mail that does not exist?

    Trying to remove my trash an email that says does not exist. He seems to be now my recycle bin to empty properly. I get this message... The file '153539.emlx' could not be opened because there is no file.

    Please, back up all data. Rebuild the mailbox. Try again to delete the message. If there is no change, and if the account in question is on an IMAP or Exchange Server, see below.

    In the Mail menu bar, select

    ▹ mail preferences... ▹ Accounts

    Select the accounts in the list on the left, then open the behaviors of the box tab, uncheck the box marked

    Store the deleted messages on the server

    Save changes when prompted.

  • Find a record that does not exist and displays a message

    When I run the following query why used, it displays the word 'FAILURE '.
    SELECT 
      CASE 
        WHEN table_name IN('DBA_OBJECTS') THEN 'PASS' 
        ELSE 'FAIL' 
      END TABLE_EXISTS 
     FROM dictionary 
    WHERE table_name = 'DBA_OBJECT'
    ;
    Ben

    Hey Benton,

    The query filter (WHERE table_name = 'DBA_OBJECT') cause zero record is returned.

    To trick you can use aggregate function that always return the single record even if the record is found or not. If no record is found, NULL is returned.

    SQL> SELECT CASE WHEN MAX(table_name) IN('DBA_OBJECTS') THEN 'PASS' ELSE 'FAIL' END TABLE_EXISTS -- OR NVL2(MAX(table_name),'PASS','FAIL') TABLE_EXISTS
      2  FROM dictionary
      3  WHERE table_name = 'DBA_OBJECT'
      4  AND ROWNUM = 1
      5  /
    
    TABLE_EXISTS
    ------------
    FAIL
    
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    
  • How to disable the AppStore offers updated app that does not exist on the ipod touch 5g ios 9 and Reset counter app

    Regularly I receive notifications of updated Brainiacs Sudoku which I had deleted Ipod Touch 5 g a long time ago.  I can't disable the app update counter until I have download the update.  So, how to disable the AppStore offers updated app that does not exist on the ipod touch 5g ios 9 and Reset counter of the application once and for all?

    Try to hide this purchase

    Hide and show purchases iTunes or iBooks on your Mac or PC - Apple Support

  • [SOLVED] Backup Windows 7 gives an error message 'file ignored' for a subfolder that does not exist in Documents

    I am running with "Backup and Restore" backups in Windows 7 Professional and constantly get this error in the logs:

    Backup has encountered a problem during the practical C:\Users\Tim\Documents\Blender file backup. Error: (the system cannot find the specified file. (0 x 80070002))
    "Practical Blender" is a folder I previously removed documents and backup should not be looking for it. I tried to remove the job from the scheduled backup with Windows Task Scheduler and create and execute a new backup job, but the problem goes away. It is only this specific file gives me this problem. I deleted the other folders of Documents before and since it was started without any problem of backup.

    Is it possible that I can stop backup to find this file that does not exist?

    What happens when you recreate this folder?

  • AppleID asks a password for an ID that does not exist

    When I try to update my apps on my phone I wonder to enter a password for an AppleID that does not exist.

    I am connected and can't seem to download applications, but not updated.  I don't have this problem with my iPad using the same account, just the iPhone.

    Help please!

    Girlactik wrote:

    When I try to update my apps on my phone I wonder to enter a password for an AppleID that does not exist.

    This identifier Apple is not simply "composed" without any basis.

    • The iPhone is already possessed?  Maybe it's the Apple ID of the previous owner?
    • Maybe it's the Apple ID you entered by mistake at settings > iTunes and App Store?  Or settings > iCloud?
    • Wouldn't be the Apple ID of the owner of the apps?  You use apps (or music or books) someone else bought?
  • After the upgrade from my bookmarks list shows the entries less than before; the indications you have search a Profiles folder that does not exist.

    After Update Firefox on all November 9, I lost the list of bookmarks that I had before and it could access it from my homepage. Now it does not appear there. When I followed the instructions on your mozillazine.org help page, it says to find a profile file that does not exist with this version.

    One possible cause is a problem with the places.sqlite file that stores the bookmarks and history.

  • Satellite L300 - peripheral USB need drivers that does not exist

    Satellite L300 race Win Vista 32 bit, connection of new devices (for example the card reader USB Signalex), I ask for a device driver that does not exist on the computer or on the Web and should not be necessary.

    How to do this? My previous laptop under Vista did not ask this.

    Hi Greenman,

    Have you tried other USB devices such as a USB or disk external DRIVE with USB interface? Normally you n t need additional drivers for most USB devices except printers for example.

    More I recommend removing all the USB ports on the Device Manager and then restart the laptop.

  • The Apple showing in the page settings of ICloud ID does not go and watch my old email address that does not exist as an Apple ID.

    ID showing in the page settings of ICloud Apple won't and watch my old email address that does not exist in the Apple continues to him I identification code is required to sign in this old apple ID, but when I try to reset the password of the site Web of Apple tells me that this 'old' email address is not a piece of identification If that makes sense. I tried to disconnect from ICloud, but always keep asking the password sign to find my Ipad.

    I know my good Apple ID and password and have checked the details on Apple's site that shows the Ipad on the list of devices.

    The Ipad will connect has WiFi and I took it at John Lewis today where I bought it and they think that the problem is being caused by this problem of ID.

    Another that take it to the Apple store, anyone have any suggestions please?

    Welcome to the Apple community.

    If you are unable to remember your password, security issues, do not have access to your address of rescue or are unable to reset your password for any reason, your only option is to contact the Support of Apple ID, to speak to an operator you should explain that your problem is related to your Apple ID This way you can be attributed to the assistance, even if you do not have an AppleCare plan.

    You will need to be patient with the process and to be ready to prove without doubt that the account belongs to you. Do not expect access to be restored immediately and if you are not the owner of the Apple ID saved to the device the account will not be reset.

  • diskette drive 0 seek failure. If I hit f1 continue, then every thing works normally. Looks like it's looking for an active drive that does not exist

    diskette drive 0 seek failure. If I hit f1 continue, then every thing works normally. Looks like it's looking for an active drive that does not exist

    This message comes to the BIOS screen that appears before Windows starts?  If so, go to the BIOS Setup and disable the floppy drive.

  • I can't log out of my account that does not exist

    I tried to disconnect from my Windows account, because I realized that I had already done one through Xbox, and my computer has not been cooperating with me, so I went to the Microsoft website and closed my account, but when I went into the menu Configuration from PC, it prompted me a password for an account that does not exist. I tried every single password, I could possibly use, or even recreate the same e-mail account and reset the password for that many times but nothing has worked. Is it possible to log out of my account does not exist without format my computer?

    You can convert your computer account to a local account in the settings of PC, or did request a password?

  • Ask CC 2015 for osx 10.8.7 that does not exist! Last Mountain Lion is 10.8.5.

    Hi I would like to try CC 2015 on my macbook pro with Mountain Lion but the installation of the installer said it is only compatible with OS X 10.8.7 that does not exist, latest version of Cougar is 10.8.5.

    You should go to yosemite, if you can system requirements | Cloud Creative

  • TypeError: Error #1010 on code that does not exist.

    Hi all

    I have a drop down list with 7 options. The menu is a clip with a mask that reveals to each buttons when a person mouse_overs touch menu. Each option of the menu does the same thing, it calls a function based on the clicked button. The function of each button does the same thing:

    function INDEX_Safety (e:MouseEvent): void

    {

    Play();

    INDEX_SAFETY = true;

    Sound_Stopper ();

    }

    Each function will change the value of its variable Boolean respecive. One for each button. Its CAP is a function that stops all sounds FLV which is currently playing.

    When it goes through play() it will come to a particular framework that presents:

    Index_Jumper ();

    This function determines what boolean is set to true and made a gotoAndPlay ("name") based on the Boolean value that has been set to true. Then sets the Boolean back to false.

    function Index_Jumper (): void

    {

    If (INDEX_SAFETY == true) {gotoAndPlay ("Safety"); INDEX_SAFETY = false ;}

    If (INDEX_TOOLS == true) {gotoAndPlay ("tools and Positions"); INDEX_TOOLS = false ;}

    If (INDEX_METHODS == true) {gotoAndPlay ("methods"); INDEX_METHODS = false ;}

    If (INDEX_METHOD1 == true) {gotoAndPlay ("method 1"); INDEX_METHOD1 = false ;}

    If (INDEX_METHOD2 == true) {gotoAndPlay ("method 2"); INDEX_METHOD2 = false ;}

    If (INDEX_TDBL == true) {gotoAndPlay ("installation TDBL"); INDEX_TDBL = false ;}

    If (INDEX_RAISING == true) {gotoAndPlay ("the Outreach booth"); INDEX_RAISING = false ;}

    }

    The question I have: when I click on option 6, TDBL, I get the error:

    TypeError: Error #1010: a term is undefined and has no properties.

    at RaisingtheOperatorsPlatform_fla::MainTimeline/frame147() [RaisingtheOperatorsPlatform_fla. MainTimeline::frame147:10]

    It is said framework 147:10

    From my understanding, this means the 10th line on frame 147.

    It's my frame 147:

    1. stop ();

    2 legend ();

    3 IndexMC.Safety_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Safety);

    4 IndexMC.Tools_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Tools);

    5 IndexMC.Methods_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Methods);

    6 IndexMC.Method1_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Method1);

    7 IndexMC.Method2_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Method2);

    8 IndexMC.TBDL_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Tdbl);

    9 IndexMC.Raising_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Raising);

    I don't have a 10 line.

    also, when I click option 7, nothing happens. However, options 1-5 on the drop in the menu drop-down work very well.

    Thanks for any idea.

    Just after the announcement, I had an idea to try to add the following in order to frame 1:

    addEventListener (Event.ENTER_FRAME, Frame_147);

    function Frame_147 (event: Event): void

    {

    If (currentFrame is 147)

    {

    Stop ();

    Legend ();

    IndexMC.Safety_Menu_Button.addEventListener (MouseEvent.CLICK, INDEX_Safety);

    IndexMC.Tools_Menu_Button.addEventListener (MouseEvent.CLICK, INDEX_Tools);

    IndexMC.Methods_Menu_Button.addEventListener (MouseEvent.CLICK, INDEX_Methods);

    IndexMC.Method1_Menu_Button.addEventListener (MouseEvent.CLICK, INDEX_Method1);

    IndexMC.Method2_Menu_Button.addEventListener (MouseEvent.CLICK, INDEX_Method2);

    IndexMC.TDBL_Menu_Button.addEventListener (MouseEvent.CLICK, INDEX_Tdbl);

    IndexMC.Raising_Menu_Button.addEventListener (MouseEvent.CLICK, INDEX_Raising);

    }

    }

    I then commented out frame 147.

    the error showed up on line 36 of the frame 1, which is:

    IndexMC.TDBL_Menu_Button.addEventListener (MouseEvent.CLICK, INDEX_Tdbl);

    Being able to focus on it, I see that I have IndexMC.TBDL instead of IndexMC.TDBL, I think it was one of those "leaning on this thing for too long errors." Thank you for looking into it, the problem is now resolved. In regard to the error pointing to a line that does not exist:

    I still have no idea why he would say that was frame 147:10

  • Spool print not that does not exist

    Hello

    I have this problem with the coil of printing in Windows 8 Pro Services. This service does not exist in the services. How can I get it back? I can not install anything related to printers without it.
    PS: the problem is that he is not arrested, but there was none.
    My best regards.
    Rafik

    Hi Rapheek,

    Thanks for joining us again.

    You must copy and paste all the commands written in "BOLD" from the previous post on a Notepad and name the file as spooler.reg and save it to the desktop. Then double-click to run the file. This would create the print spooler service.

    Let us know the status of the issue.

  • The button "delete twilight" under effects does not exist in my lightroom Version 6.5, what am I supposed to do?

    I ve installed my version 6.5, but the button does not exist. What should I do?

    Again Hello Rolf,

    Stimmt, erw'hnt of erst das wird, wenn man oben auf 'Neuerungen"klickt. Dann lieber too equal die Seite mit den Neuerungen und die Versionen, die sind vertreten: Neuerungen in Lightroom... Das ist, is the suchst?

    Grüße,

    Holger

Maybe you are looking for

  • Restore media for a Sat Pro A10

    Hi, I lost my press kit for my Sat Pro but unable to download the drivers from the support site... everytime I try I just get a message saying that the file is not found. Can I download an ISO of the restore media, or someone can look at the download

  • Windows Vista - error 663 when installing updates

    Updates failed for a few weeks now and get error Code 663.  I checked the forums online and cannot find a solution. Your help will be greatly appreciated.

  • Unexpected shutdown now blue screen

    the windos is suddenly stopped and blue screen apear what should I do? original title: problem

  • door problems

    I took my laptop HP Windows 7 Premium to fix my Deskjet 1000 J110a printer worked very well, when I got my PC back, I have tried to reinstall my printer, but the Deskjet 1000 J110a does not appear on the list of install.  What I do to update and inst

  • Unexplained Tablespace growth then shrinks in 11g

    Is there something in the automated jobs that cause a tablespace to show growth, then shrink within 10-15 minutes?  We alerted through OEM of a WARNING, followed shortly after by a time CLEAR.  I remember reading something on this time, but couldn't