How can i find out the table hierarchy

Hi experts,
I have one doubt. how can i find out the table hierarchy in the particular schema.
Let me explain my requirement in detail.. In my Database i have nearly 250 table each table have it's own temporary table(for authorization purpose we are maintaining the temporary tables) for each day i have to clear the temporary table data.
All temporary table connected with each other. i mean all the table having foreign key relationship.. while i attempt the delete the data from the temporary table it showed ORA-02292: integrity constraint  violated - child record found.
So can any one please tell how can i delete the child table record first and then parent record table record.
Thanks in advance
Arun

CREATE OR REPLACE FUNCTION get_child_tables (
ptable VARCHAR2,
powner VARCHAR2 DEFAULT 'SCOTT',
plevel NUMBER DEFAULT 10
RETURN stringarray
-- -- create this ON SQL*PLUS "CREATE OR REPLACE TYPE STRINGARRAY AS TABLE OF VARCHAR2(50);"
-- AUTHID CURRENT_USER
PIPELINED
AUTHOR DATE VERSION COMMENTS
======================================================================================
[email protected] 26-OCT-2009 1.0 Developed to ease developers effort to find Nth level of Referential integrity
======================================================================================
-- PURPOSE -> To find PARENT=> CHILD relational TABLE(S) in Oracle upto a depth max N Level.
--SYNTAX TO USE
SELECT * FROM TABLE( get_child_tables('DEPT','SCOTT',3)); Store this query in a file for your use
SELECT * FROM TABLE( get_child_tables('EMPLOYEE')); Store this query in a file for your use
-- RESULTS looks as below
--1 => DEPT
--2 => EMP
--2 => EMP2
--3 => EMP_CHILD
--3 => EMP2_CHILD
-- and so on
--This can be leveraged to use in any oracle database REGION 10g having and above.
--This FUNCTION gives formatted result of the Oracle 10g Hierarchical query result coded in the cursor
--to find MASTER => CHILD relational TABLE(S) upto a depth max 10 Level.
--The result of the PIPELINED function can be retrieved using Oracle new operator
--TABLE(array name) in SQL query.
--Due to the AUTHID CURRENT_USER compiler directive any user can use based on his/her access privileges on the database.
--GRANT EXECUTE ON SCOTT.get_child_tables TO PUBLIC;
--CREATE OR REPLACE PUBLIC SYNONYM get_child_tables FOR SCOTT.get_child_tables;
IS
atname stringarray := stringarray ();
-- create this ON SQL*PLUS CREATE OR REPLACE TYPE STRINGARRAY AS TABLE OF VARCHAR2(50);
vlevel NUMBER;
vtname VARCHAR2 (50);
nindex NUMBER := 0;
bprocessed BOOLEAN := FALSE;
CURSOR c1 (powner_in IN VARCHAR2, ptable_in VARCHAR2, plevel_in NUMBER)
IS
SELECT LEVEL, LPAD (' ', (LEVEL - 1) * 2, ' ') || pt AS "TNAME"
FROM (SELECT a.owner w1, a.table_name pt, a.constraint_name c1,
a.r_constraint_name r1, b.owner w2, b.table_name ct,
b.constraint_name c2, b.r_constraint_name r2
FROM all_constraints a, all_constraints b
WHERE a.constraint_name = b.r_constraint_name(+)
AND a.owner = b.owner(+)
AND a.owner =
UPPER (powner)
-- Change Owner here while testing
--AND A.r_constraint_name IS NULL
AND a.constraint_type IN ('P', 'R')) v1
START WITH pt =
UPPER
(ptable)
-- Change your master table here while testing the QUERY
CONNECT BY PRIOR ct = pt AND LEVEL <= plevel;
-- Change lavel here while testing
BEGIN
atname.EXTEND;
atname (1) := 'NOTHING';
OPEN c1 (powner, ptable, plevel);
LOOP
bprocessed := FALSE;
FETCH c1
INTO vlevel, vtname;
IF nindex > 1 AND atname (atname.LAST - 1) = vtname
THEN
--DBMS_OUTPUT.PUT_LINE('2 ==== vtname  ' ||vtname || '   '|| atname.count|| '   '||atname.last ||  '   '||atname( atname.last-1));
bprocessed := TRUE;
END IF;
IF NOT bprocessed
THEN
nindex := nindex + 1;
atname.EXTEND;
atname (nindex) := vtname;
PIPE ROW (vlevel || ' => ' || vtname);
DBMS_OUTPUT.put_line ( ' **** nindex - atname( nindex) '
|| nindex
|| ' - '
|| atname (nindex)
DLOG('ADDING ',vTname); A LOGGING ATONOMUS PROCEDURE FOR DEBUG PURPOSE
END IF;
EXIT WHEN c1%NOTFOUND;
END LOOP;
CLOSE c1;
FOR i IN 1 .. atname.COUNT
LOOP
DBMS_OUTPUT.PUT_LINE('atname (i) ' ||atname (i));
END LOOP;
RETURN;
EXCEPTION
WHEN no_data_needed
THEN -- THIS EXCEPTION HAS TO BE THERE TO GET THE FUCTION WORKABLE
DBMS_OUTPUT.put_line (SQLERRM);
RETURN;
--SELECT * FROM TABLE( get_child_tables('TB_XOP_LETR_TEMPLATE','OPS$CMS',5));
END get_child_tables;
Edited by: user3066657 on Jul 21, 2011 8:42 AM
Edited by: user3066657 on Jul 21, 2011 11:26 AM

Similar Messages

  • How do i find out the tables (data)effected in a schema after a particular time stamp

    how do i find out the tables (data not structure)effected in a schema after a particular time stamp?
    pls email in [email protected]

    You can't do that. That would be a real security risc.
    /KAj

  • How do i find out the tables effected in a schema after a particular time stamp

    how do i find out the tables effected in a schema after a particular time stamp?
    pls email in [email protected]

    If you are doing a reload every time then you can issue following commands to clear data from cube.
    lmt name to all
    allstat
    clear all from <cubename>prttopvar
    You can wrap above commands in pl sql procedure using dbms_aw.execute package and execute it before cube load starts. Instead of clearing it from whole cube you can clear only from one partition also. Just take a look at clear command in olap DML 10.2 reference.
    Thanks,
    Brijesh
    Edited by: Brijesh Gaur on Aug 10, 2010 6:47 AM

  • How can I find out the list of users who has the access to IT 0008

    All,
    How can I find out the list of users who has the W R permission for IT 008
    for others?
    SUIM doe not look like giving me the correct results.
    Please advise.
    Thanks,
    From
    PT.

    combine tables AGR_1251 and table AGR_Users on keyfield AGR_USERS
    in tabel AGR_1251 select on Field LOW values IT0008.OR W OR R,
    noiw you get also other values
    So better solution run the query twice over AGR1251 first on IT0008 and secondly on values W OR R and then the result over table AGR_USERS
    Youu also might put an additional selection on object P* (only selecting HR objects)
    output wll be UID in table AGR_USERS

  • How can I find out the first intial row in VA02-output transaction??

    How can I find out the first intial row in the screen which appears during sales order change (VA02) >>enter the sales order number >>after the first screen appears >>in the menu bar go to EXTRAS>>OUTPUT>>HEADER>>EDIT??
    I have to find out the first row in the OUTPUT column which is empty,then populate it with some data using BDC.
    usefull answers will be rewarded.
    regards,
    Shashank .

    Pass the sale order number in the object key of NAST table,
    if u get 3 entires, then u need to place ur entry in the fourth row in that table control thru BDC.
    I think u got the logic.
    Regards,
    Sujatha.

  • How can I find out the age of my imac

    How can I find out the age of my computer to see if it will be able to download latest operating system

    Open System Profiler in Utilities folder. Look for the Model ID on the right. Then see the following:
    Upgrade Paths to Snow Leopard, Lion, and/or Mountain Lion
    You can upgrade to Mountain Lion from Lion or directly from Snow Leopard. Mountain Lion can be downloaded from the Mac App Store for $19.99. To access the App Store you must have Snow Leopard 10.6.6 or later installed.
    Upgrading to Snow Leopard
    You can purchase Snow Leopard through the Apple Store: Mac OS X 10.6 Snow Leopard — Apple Store (U.S.). The price is $19.99 plus tax. You will be sent physical media by mail after placing your order.
    After you install Snow Leopard you will have to download and install the Mac OS X 10.6.8 Update Combo v1.1 to update Snow Leopard to 10.6.8 and give you access to the App Store. Access to the App Store enables you to download Mountain Lion if your computer meets the requirements.
         Snow Leopard General Requirements
           1. Mac computer with an Intel processor
           2. 1GB of memory
           3. 5GB of available disk space
           4. DVD drive for installation
           5. Some features require a compatible Internet service provider;
               fees may apply.
           6. Some features require Apple’s iCloud services; fees and
               terms apply.
    Upgrading to Lion
    If your computer does not meet the requirements to install Mountain Lion, it may still meet the requirements to install Lion.
    You can purchase Lion by contacting Customer Service: Contacting Apple for support and service — this includes international calling numbers. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.
    Upgrading to Mountain Lion
    To upgrade to Mountain Lion you must have Snow Leopard 10.6.8 or Lion installed. Purchase and download Mountain Lion from the App Store. Sign in using your Apple ID. Mountain Lion is $19.99 plus tax. The file is quite large, over 4 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
         OS X Mountain Lion — System Requirements
           Macs that can be upgraded to OS X Mountain Lion
             1. iMac (Mid 2007 or newer) — Model Identifier 7,1 or later
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) —
                 Model Identifier 5,1 or later
             3. MacBook Pro (Mid/Late 2007 or newer) — Model Identifier 3,1 or later
             4. MacBook Air (Late 2008 or newer) — Model Identifier 2,1 or later
             5. Mac mini (Early 2009 or newer) — Model Identifier 3,1 or later
             6. Mac Pro (Early 2008 or newer) — Model Identifier 3,1 or later
             7. Xserve (Early 2009) — Model Identifier 3,1 or later
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
    Are my applications compatible?
             See App Compatibility Table — RoaringApps.
         For a complete How-To introduction from Apple see Upgrade to OS X Mountain Lion.

  • How can I find out the java version Oracle has ?

    How can I find out the java version Oracle has built in?
    I've tried with ..
    SELECT comp_id, comp_name, version
    FROM dba_registry ;
    But I get.."table doesn't not exist".
    Thenks in advance!

    Pl post details of OS and database versions. Pl see this MOS Doc
    What Version of Java is Compatible With The Database JVM? [ID 438294.1]     
    and these Oracle docs
    11gR2 - http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_environments.htm#ADFNS654
    11gR1 - http://docs.oracle.com/cd/B28359_01/java.111/b31225/whatsnew.htm
    HTH
    Srini

  • How can I find out whitch table are used in whitch document?

    How can I find out whitch table are used in whitch document?
    In the table EUL5_DOCUMENTS are stored the Documents and in the table EUL5_OBJS are stored the tables. How can I query these tables together?
    Are there other possiblities?
    Thanks

    Hi Dierk
    Please take a look at this thread: Re: An EUL query to list out All the Columns  (Fileds) for each Workbook
    I think you may well find what you are looking for in the answer that I gave there.
    Best wishes
    Michael

  • How can we find out the datasourse is having Beforeimage&afterimage in R/3

    Hi Guru's,
         This is Surendra,i have a doubt like' how can we find out the particular datasourse is having before image and after image in R/3 side before we are going to extract the data from R/3 to BW'.Can any body help me in this scenario.
    thanks in advance,
    Thanks&regards
    Surendra.

    Hi,
    Let  me explain it with a DS:
    So lets take DS 2LIS_13_VDITM
    So logon to R/3 -> Se11->Database table = ROOSOURCE>click on Disply->click on contents (CTRLSHIFTF10) -->mantion Datasource = 2LIS_13_VDITM.
    and OLPTSrc Version = D.
    And see the value for the field <i>Delta Process for a DataSource</i> (DELTA) .Here we get ABR as the value for the field.
    And also you can find all available values for DELTA field.
    With rgds,
    Anil Kumar Sharma .P

  • How can I find out the dpi of an image in Acrobat.

    How can I find out the dpi of an image in Acrobat. I have tried the pre-flight option but I really don't understand the pixels width x depth information that I get. I basically just want to know at dpi of a single image. Is there other program that will read my pdf file and tell me this information.

    Thank you, tylerdurdain! That was ridiculously difficult to find. Not sure what version of Acrobat you're using in your image, but for those using Acrobat Pro 11 (in Mavericks), it's buried under View > Tools > Print Production.
    That opens a panel on the right.
    To keep from having to chase it down this way each time, right click on "Output Preview" and choose "Add to Quick Tools Toolbar". That adds a button to the top right of the toolbar.
    Now you can call up the inspector with one click. Choose Object Inspector as tylerdurdain shows above, then click on the item displayed to get its properties.

  • How can you find out if another VI running on the same computer and how can you find out the name of that VI?

    Suppose that several VIs running simultaneously on the same computer. How can I find out the names of the running VIs, from another VI?
    If the already running VIs are clones of the same basic VI, open and run with the option "Prepare to call and forget", how can I find out the names and index of each clone? 

    I had an application where I spawned (= ran with Start Asynchronous Call) multiple (reentrant) copies of VIs, and would occasionally "lose control" of them.  I needed a way to find all VIs that were running "Top Level" and stop them (so I didn't have to log off from Windows).
    I used the Application Property "All VIs in Memory" to get an array of (wait for it ...) All VIs in Memory.  I took each name, opened a VI reference to it (simply wire the name string in, as the VI is, by definition, "in memory"), looked at its VI Execution State, and if it was Run Top Level, Invoked the FP.Close and Abort VI Methods.  [To prevent the VI that did all this from "committing Suicide", I compared the name string with the current Call Chain, and did nothing if there was a match].
    I think you could adopt this idea to do what you need.
    BS

  • How can I find out the mail server from email address?

    Hi:
    How can I find out the mail server from email address?
    for example: If I know the email address is [email protected],
    how to find the pop3 and smtp mail server?
    THANK YOU

    You can't tell by the email address since you can pretty much put whatever you want in there (especially if the SMTP server is not filtering anything).
    The header may be able to tell you something. There is a Received header value which looks like it has the routing information although I am not sure if this is a complete trace or just the last hop the message took.
    Sean

  • How can I find out the screen size of the users moniter using the Acrobat SDK?

    How can I find out the screen size of the users moniter using the Acrobat SDK? I need to know how much sreen real estate that is available on the users moniter. Is there some call that I can make from the SDK to discover the maximun X and Y coordinates?
    Thanks,
    Gregory

    Currently, I am testing on multiple moniters and it is defaulting to the moniter designated as the #1 moniter. For our purposes, this is acceptable. Once the two documents have loaded, the user can move and re-size at will.
    Gregory

  • How can i find out the more than one times occurance of integer in a array?

    How can i find out the more than one occurance of integer in a array. Assume i have 2,2,3,4,2,5,4,5 in a Array and i need to find out the how many times of 2, 5 and 4 is exists in that array. Please some one help me as sson as possible. thanks in advance....

    Kumar_Mohan wrote:
    How can i find out the more than one occurance of integer in a array. Assume i have 2,2,3,4,2,5,4,5 in a Array and i need to find out the how many times of 2, 5 and 4 is exists in that array. Sort the array. Then loop through it and compare each i-th element with the (i+1)-th element.
    Please some one help me as sson as possible. thanks in advance....In future postings, please refrain from telling that it is urgent, or you need help ASAP. It is rather rude to do so.

  • How can I find out the apn number of the battery without having it?

    I dont have the battery of my iphone 5 anymore but how can i find out the apn number of the battery? I would like to change it but i need to know the apn number to choose the right battery.

    Apple does not provide any user-serviceable parts (other than accessories or sometimes a SIM card tray).
    Therefore, there are no legitimate iPhone batteries available for sale anywhere.
    Anything you find will either be salvaged, counterfeit, or stolen.

Maybe you are looking for

  • First Flash Button Not working

    I am new to Flash, so please forgive me if this is a basic question. But I have searched and searched and cannot find the answer. I've tried everything I can think of - but nothing is working. I have a button I created in Flash - I've used the follow

  • IPod Radio Remote(device that enable my iPod to function as a radio

    When I initially plugged the radio adapter into my nano I was able to control turning it on/off ,etc. directly from the radio adapter. Now I when I plug it in my nano starts playing my albums and not the radio. Very annoying - how can I fix?

  • Blank screen but powers on

    i have an older imac bought in i think about 06 i cut the power button on and you can hear it powering up and the light in bottom right hand corner also lights up, but there is a blank screen. No picture at all. What can possibly be wrong. please hel

  • Oracle DB Query Generating Invalid Column Index error

    Dear All, Apologies for a question on this rather basic error but I don't understand why i'm experiencing the behaviour described. The piece of code below connects to a database, runs a query, then attempts to display the contents of the resultset. I

  • Problem starting the server  WLS after installing OIM11g

    Failed to restart weblogic server after installing Oracle Identity Manager 11g. Weblogic server log Part: ####<Dec 23, 2010 4:15:19 PM PST> <Info> <Deployer> <IAM11G> <oim_server1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (sel