How to query for tables referenced to a certain table by a FK?

Hello -
I have a table called "SERVICE". i can't drop the table because it is referenced via a foreign key by other tables. What view(s) can I query to find the referenced tables?
Thanks in advance!

Does this query help?
select /*+ parallel(4) */
pk.table_name parent_table_name, pk.constraint_name pkey_constraint,
fk.table_name child_table_name, fk.constraint_name fkey_constraint, fk.r_constraint_name
from
user_constraints pk,
user_constraints fk
where
pk.constraint_name = fk.r_constraint_name
and pk.constraint_type='P'
and fk.constraint_type='R'

Similar Messages

  • How to query for two tables

    Hi,
    I have this problem, How can query a two table?
    Table A ->  Table B
    id               table-a_id
    name          table_b_name
    the relationship is one-to-many
    How can I get the result?
    Hope my question make sense
    cheers.
    thanks a lot.

    I bet you have more luck looking for an answer in a SQL forum.

  • How to query for foreign encoded text via REST service

    I am using APEX 4.2.1.00.08 to publish RESTful web services that query a table of place names. The place names include foreign encoded alternates. My search field has type of NVARCHAR2 and the db has NLS_CHARACTERSET of AL32UTF8. Querying for foreign encoded names works fine from other applications (e.g. TOAD, ArcGIS).
    In APEX under 'SQL Workshop | RESTful Services' I have created a module, resource template, and resource handler. When I use 'Set Bind Variables' to test the service, it works for 'English' names with no problem (e.g. 'London').
    However, when I query for a foreign equivalents like 'ロンドン', the Japanese version of 'London', I get the following error:
    400 - Bad Request
    The request path contains illegal characters
    How do I get foreign encoded place names to work as the bind variable value of a REST service?

    Does this query help?
    select /*+ parallel(4) */
    pk.table_name parent_table_name, pk.constraint_name pkey_constraint,
    fk.table_name child_table_name, fk.constraint_name fkey_constraint, fk.r_constraint_name
    from
    user_constraints pk,
    user_constraints fk
    where
    pk.constraint_name = fk.r_constraint_name
    and pk.constraint_type='P'
    and fk.constraint_type='R'

  • How to query for unacceptable characters

    Hi there. I can query for acceptable characters but would like to query for unacceptable characters. Please see the below thread. thanks in advance!
    How to find Special Characters in a table ?
    ~Darby

    Sorry, missed it in the other post (already saturday here). So without using regular expressions. I'm a little confused now I must say.
    You want to search for unacceptable characters (I assume those characters are known this time):
    length(the_column) - length(replace(translate(the_column,'UNACEPTBL','*'),'*','')) > 0
    Regards
    Etbin

  • How to Query up Monthly Closing Balance on a Table of Transactions

    Probably a simple question for an analytics wizard, but I'm not there yet...
    Suppose I have a table of financial transactions named TX with TX_DATE and TX_AMOUNT columns and that some months may not have any transactions (i.e., there are gaps). I would like to know the best query for returning the closing monthly balance with no gaps. I suspect it will involve a trick I saw on asktom.oracle.com for generating the list of months between two dates, some outer join cleverness, the use of SUM(TX_AMOUNT) OVER (ORDER BY TX_DATE) or something to generate the running account balance, and some magic to pluck out the last balance amount for each month.
    The trick I saw from askTom for generating a gap-less list of months looked like:
    with date_range as
    (select to_date('1/1/2007','mm/dd/yyyy') mindt, sysdate maxdt from dual)
    select level, add_months(mindt,level-1) dt
    from date_range
    connect by level <= months_between(maxdt,mindt)+1
    (assuming in this case the range of tx dates was Jan 1, 2007 through today).
    Any assistance would be greatly appreciated.
    Thanks,
    Bill

    Sorry for the lack of clarity - by closing monthly balance, I mean I want the balance of the account as of the end of each month. So, you have to keep a running balance across the transactions (including a data point for months with no transactions) and then grab the running balance out for the latest transaction in each month. I have all but that last bit (which may be answered by another recent thread that I am reading). Here is what I have so far:
    with date_range as
    (select min(transaction_date) mindt, sysdate maxdt
    from fz_transaction
    where account_id = 320001
    all_months as
    (select level, add_months(mindt,level-1) dt
    from date_range
    connect by level <= months_between(maxdt,mindt)+1
    gapless_transactions as
    (select id, transaction_date, amount
    from fz_transaction
    where account_id = 320001
    union all
    select 1 id, dt transaction_date, 0 amount
    from all_months
    running_balance as
    (select id, transaction_date, sum(amount) over (order by transaction_date, id) balance
    from gapless_transactions
    order by transaction_date desc, id desc
    select * from running_balance
    -- Working on this last part to pull out the last entry in each month...
    Note that the UNION ALL in the gapless_transactions part throws in a bogus (but harmless in this computation) $0 transaction each month so I have no gaps in any month.
    Perhaps there is a more elegant strategy, but I think I'm almost there...

  • How to query for messages on JMS Queue?

    Hi All,
    What is the best way to query on a JMS Queue? I would like to query for messages based on values entered on a screen. Can this be achieved using the JMS Adapter or any other adapter?
    JDev : 11.1.1.4
    Thanks and Regards.

    Hi,
    I am not 100% clear on your requirement and what selection criteria you need. I would be surprised if you need the DB adapter. If you just want to query how much message are in the queue or other related queries for example related to header information then DB adapter can be used. This only works when JMS queue is stored in the database. Personally I have never come across this requirement.
    I suggest to look in more detail of the JMS adapter. The JMS adapter can be used to select (subscribe) to certain messages. Please read the below for more information:
    http://docs.oracle.com/cd/E17904_01/integration.1111/e10231/adptr_jms.htm#CJACBCHJ
    The message is automatically removed from the queue (implicit delete) the moment it is picked-up. I would not recommend deleting a message directly from the queue using DB adapter. What is the point of publishing the message in the first place?
    Thanks
    Sander

  • How to query for XML-attribute with XPATH

    Hi,
    Isn't there somebody, who can tell me how to query an Attribut of an XML-element correctly ?
    All my trials lead to empty rows. What's worng in my XPATH-expresion ?
    XML-file looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <xmlexport>
    <itsystem guid="e51b91d1-ab0f-11db-2cd7-001641105333">
    <field fieldidentifier="currentVersion" />
    <field fieldidentifier="marketdatacosts">0</field>
    I can query fine the elements and sub-elements, but not attribute 'guid' of /xmlexport/itsystem. Here some trials, all lead
    SELECT t.* FROM CORIA."xmlexport156_TAB", xmltable ('/xmlexport/itsystem ' passing object_value COLUMNS
    GUID     VARCHAR2(1000) path '[@guid=*]') t
    various versions for Xpath:
    path '[@guid="*"]'
    path '/[@guid=*]'
    path '[@guid=*]'
    xmltable ('/xmlexport' ...
    path '/itsystem/[@guid=*]'
    ... combinations of part 1 and 2
    thanks for any hint, LaoDe

    You can either get them directly, or fetch the attribute in your xquery and put them in returning xml fragment, then get them like normal element.
    Method #1:
    path '@guid'
    Method #2:
    xmltable(
    let $is := /xmlexport/itsystem
    return <r><guid>{$is/@guid}</guid></r>
    passing object_value
    columns guid varchar2(1000) path '/r/guid')

  • How to Query for Hidden Chars

    Hello -
    I have a large number of E-mail addresses that were corrupted with hidden characters. I have a bunch of question marks, squares, etc. mixed in with the E-mail addresses. Is there a way to query for these values?
    Thanks in advance for guidance.

    Assuming you can identify the numeric range of the invalid characters (i.e. ASCII 0-31) and the numeric range of the valid characters, you have some options. There is an example of replacing all the invalid characters in a string using the TRANSLATE command here
    http://www.ddbcinc.com/askDDBC/topic.asp?TOPIC_ID=216
    (note that you have to be able to define functions that return the invalid characters and the valid characters). You can find out where there are invalid characters by comparing the length of the raw column to the length of the translated column
    SELECT *
      FROM <<table>>
    WHERE LENGTH(email) != LENGTH( TRANSLATE( email, safeCharacters || nonPrintingCharacters, safeCharacters ) )Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to query for a NULL value?

    Hi all,
    how can I query for a NULL value in a ViewObject. I tried to set null as where-clause param [setWhereClauseParam(0, null)]. But the created statement looks like this:
    SELECT ...
    FROM ...
    WHERE param = null
    I would expect it to create something like WHERE param IS NULL. I hope anybody has a solution for this.
    Thanks,
    Axel

    I think you should use setWhereClause("COL_NAME IS NULL")
    You could use setWhereClauseParam(0, "NULL"), but only if you have a predefined query similar to: "SELECT X, Y, Z FROM A WHERE X IS :0" (which is a pretty useless query, as you can ONLY set "NULL" as the value for ":0").

  • How to query for specific filename

    I'm using a modified folder_action script to ftp files up to a server once they're finished being created.
    Is there a way to query for a specific filename to be present in the folder prior to passing it to the actual ftp function? The catch is that the filename will always be in the format of <mmddyy>.mp4. During the process that is creating the actual file to be ftp'd, various temp files are created prior. I'd like to ensure that only the final version of the mp4 is acted upon, which is the one with the mmddyy as the filename.

    The folder action already has the folder and the item paths passed to it, so you can get the individual file name by using something like:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    on adding folder items to this_folder after receiving added_items
    repeat with AnItem in added_items
    if text (count (this_folder as text)) thru -1 of (AnItem as text) is "<mmddyy>.mp4" then
    -- whatever
    end if
    end repeat
    end adding folder items to
    </pre>
    There are also temporary folders that the system provides, so you shouldn't have to use the folder with the attached action at all:
    get path to temporary items
    get path to temporary items from user domain

  • How do I "pull" date-referenced data from one table to another?

    I have two tables: DateNamesTable and DisplayTable.
    DateNamesTable has two columns: OrigDate and Name.
    Data could look like this (ugly dashes used for "column" spacing, sorry):
    OrigDate - - - - Name
    1/12/1983 - - - James Smith
    2/7/2006 - - - - Paula Tomkins
    DisplayTable has two columns: RefDate and Name.
    On this table I am not concerned with year, only month, day and name. I want this data to look like this:
    RefDate - - - Name
    1/1
    1/2
    1/12 - - - James Smith
    1/13
    2/7 - - - Paula Tomkins
    12/31
    In other words, DisplayTable will have a row for each day of the year and the names from DateNamesTable:Name column will appear in the DisplayTable:Name column on the DisplayTable:RefDate row whose month and day correspond to the DateNamesTable:OrigDate date. (I am not concerned here with the possibility of more than one DisplayTable:Name per RefDate.)
    It would be nice if I could read the values from the DateNamesTable and "push" them or "put" them into the appropriate DisplayTable locations (sort of a reverse LOOKUP function), but that doesn't seem possible. This leaves me with having to "pull" the data into DisplayTable.
    The problem seems to require that for each DisplayTable row, I have to scan the entire DateNamesTable:OrigDate column for an OrigDate whose month and day matches the DisplayTable:RefDate and then retrieve the corresponding DateNamesTable:Name data to place in the DIsplayTable:Name cell.
    I think this should be able to be done with some combination of IF and LOOKUP functions, but I don't see how to structure it. Then again, maybe there is another way.
    Any thoughts, anyone?
    TIA,
    -- Ranebo

    Hi Yvan --
    Thank you so much. What you've given me works perfectly.
    If I wanted to modify it slightly to have the DisplayTable:RefDate column display as below, how would I need to modify your formula?
    RefDate - - - Name
    1/1/2008
    1/2/2008
    1/12/2008 - - - James Smith
    1/13/2008
    2/7/2008 - - - Paula Tomkins
    12/31/2008 - - - Yvan Koenig
    I really appreciate your willingness to share your expertise.
    Sincerely,
    -- Ranebo
    PS -- I had a screenshot but couldn't figure out how to paste it into this input window. The Help ref for formatting text made reference to an http link with an "!" leading it. I'm not familiar with that.

  • How to query for a firmware version?

    Hi,
    My customer requires to report all firmware versions for all components. How do I acquire a firmware version for a PXI card? I have a number fo card (PXI-5421, PXI-4072, PXI-6653).
    Thanks
    CT

    Hey Cimteker,
    Firmware is handled differently accross various cards. Unfortuantely because of this, there's no one easy way to get firmware versions for everycard since it isn't all handled in the same way. I'm curious what the overall application is and why all of the firmware versions for the cards are needed. The driver version updates all the firmware that's necessary. Because of this, alot of time firmware is driver dependant.
    Do you by any chance have an open service request with this same issue? We're currently looking into the firmware versions for these cards, and I'm wondering if the two issues are tied together.
    The PXI-5421 is an arbitrary waveform generator FGEN device. with FGen, there's a VI inside of the driver that will actually return the firmware. It's called niFGEN Revision Query VI. You can get there by going to NI-FGEN » Utility >» niFgen Revision Query.vi. I also believe niSCOPE has the same situation. 
    Lea D.
    Applications Engineering
    National Instruments

  • How to query for extended ASCII characters in column value

    Hi All
    Sorry if this has been answered before. I tried searching but none of them seems to work for me.
    I am trying to search for inverted ? in my column.
    I am using the following query
    select *
    from table_name
    where regexp_like (description , '¿' )

    Did you try:
    like '%¿%'
    create table table_name (description varchar2(100))
    insert into table_name values ('jh¿¿gagd')
    insert into table_name values ('jhga345gd')
    insert into table_name values ('j1231232hgagd¿')
    select *
    from table_name
    where regexp_like (description , '¿' )
    DESCRIPTION
    jh¿¿gagd
    j1231232hgagd¿
    select * from table_name
    where description like '%¿%'
    DESCRIPTION
    jh¿¿gagd
    j1231232hgagd¿Edited by: user130038 on Sep 8, 2011 12:29 PM

  • How prepare Query for time series algorithm?

    Hi every one, 
    i want next 6 month prediction, how prepare the Query ,
    I have Date column,Crime column,Incidents Column,I going with next 6 month so how we get date columns month wise or date wise,
    if month wise means,How split the Year and month from date colum??
    Please i need some help.....waiting for reply.....
    pandiyan

    Hi Leo,
    Thanks a lot for replay.
    but using  help of this blog also this problem not solve.
    is this problem can we  solve using  "Seasonal Decomposition of Time Series by Loess".
    Regards,
    Manish

  • Query for comparing two columns in two tables

    Hai, all,
    I have following two tables and columns, I need to get the rows (all columns) from scott.cp_ip which are not ( the same value present in t1 and also in t2).
    Table scott.cp_ip column cp_ip.vrno = Table scott.cb1 column cb1.cb_vnno
    I used the following query and did not get the correct result:
    select * from scott.cp_ip where cp_ip.vrno in (select cb1.cb_vnno from scott.cb1);
    Can you please tell how it can be solved?
    Thanks in advance.
    Rcs
    SQL> desc scott.cb1;
    Name Null? Type
    ID NUMBER
    SUPCODE NUMBER
    SUPLNAME VARCHAR2(100)
    NAME VARCHAR2(100)
    ITEMCODE VARCHAR2(10)
    RECDOC NUMBER
    RECDATE VARCHAR2(10)
    TOTVALUE NUMBER
    QTY NUMBER
    CB_IPNO NUMBER
    CB_VNNO NUMBER
    CB_VDT VARCHAR2(10)
    CB_AMT NUMBER
    SQL> desc scott.cp_ip;
    Name Null? Type
    ID NUMBER
    VRNO NUMBER
    CODE VARCHAR2(50)
    HEAD VARCHAR2(255)
    PARTI VARCHAR2(255)
    CR NUMBER
    SQL> select * from scott.cp_ip
    2 intersect
    3 select * from scott.cb1;
    select * from scott.cp_ip
    ERROR at line 1:
    ORA-01789: query block has incorrect number of result columns
    SQL> (select * from scott.cp_ip
    2 minus
    3 select * from scott.cb1)
    4 union all
    5 (select * from scott.cb1
    6 minus
    7 select * from scott.cp_ip);
    (select * from scott.cb1
    ERROR at line 5:
    ORA-01789: query block has incorrect number of result columns
    SQL> select * from scott.cp_ip where cp_ip.vrno in (select cb1.cb_vnno from scott.cb1);
    result=instead of 1408 rows, 1481 rows (excess 73 rows) getting!
    ----------

    Instead of SELECT * write only the column that you want to compare. I guess that would be cb1.cb_vnno and cp_ip.vrno.

Maybe you are looking for