-1

Suppose my database contains the following tables :

  • table_A with primary key PKA
  • table_B with foreign key FKA

Suppose also that I have no clue of the content of the database, except that it contains a table named table_A.

Here is my question : given table_A's name, what (PL/)SQL request do I have to make to the database to know that there is a table B that has a foreign key to table A ?

I'm using Oracle 11g

ypercubeᵀᴹ
  • 113,259
  • 19
  • 174
  • 235
Backslash36
  • 755
  • 1
  • 13
  • 28
  • Please post your attempt. Thank you for your effort. – Kermit Jan 27 '14 at 14:44
  • 1
    Check this: http://stackoverflow.com/questions/201621/how-do-i-see-all-foreign-keys-to-a-table-or-column – Hardy Jan 27 '14 at 14:44
  • 1
    Depends heavily on which sql rdbms you are using - please specify which sql you are using in your tags. – StuartLC Jan 27 '14 at 14:45
  • You need to specify your DBMS. The system catalogs (although *somewhat* standardized) are extremely different between the different vendors –  Jan 27 '14 at 14:47
  • May [the post](http://stackoverflow.com/questions/5535990/oracle-get-foreign-keys/5536400#comment30931113_5536400) will help you – Mohsen Heydari Jan 28 '14 at 15:35

2 Answers2

0

On Sql Server, you'd issue sp_help TableA

One of the result sets will let you know that TableA is referenced by TableB's foreign key.

Amy B
  • 108,202
  • 21
  • 135
  • 185
0

Hardy solved it ! Many thanks.

The answer lies in another topic, sorry for missing it.

Community
  • 1
  • 1
Backslash36
  • 755
  • 1
  • 13
  • 28