Results 1 to 5 of 5

Thread: query question

  1. #1
    Join Date
    Mar 2004
    Posts
    28

    Unanswered: query question

    hi, can anyone think of a query to select the refs in a database,
    for example select the name of a foreign key that references a given primary key if any.
    thanks for your help.

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    136
    select * from ALL_CONSTRAINTS;
    Regards,
    Julia

  3. #3
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    SELECT table_name,constraint_name,STATUS,delete_rule from user_constraints a where
    r_constraint_name = (select constraint_name from user_constraints
    where table_name = UPPER('&table_name') and constraint_type = 'P')
    and constraint_type = 'R';

    This will ask you for table_name ... It will show you the reference
    for all foreign keys to this table ...

    HTH
    Gregg

  4. #4
    Join Date
    Mar 2004
    Posts
    28
    Originally posted by gbrabham
    SELECT table_name,constraint_name,STATUS,delete_rule from user_constraints a where
    r_constraint_name = (select constraint_name from user_constraints
    where table_name = UPPER('&table_name') and constraint_type = 'P')
    and constraint_type = 'R';

    This will ask you for table_name ... It will show you the reference
    for all foreign keys to this table ...

    HTH
    Gregg
    im using jdbc so ill need a query that i can execute in an executeQuery method

  5. #5
    Join Date
    Mar 2004
    Posts
    28
    anyone any ideas??
    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •