0

I try to write a script that gathers some information about tables using Perl and the DBI module.

I have already all information regarding the columns but I can't find a way to determine which column is the primary key.

I tried googling for it but somehow the only "solution" I found did not wor (http://www.perlmonks.org/?node_id=343462)

Does anybody know how to do it? That would be very helpful

Edit: I am querying an oracle database version 12.

simbabque
  • 53,749
  • 8
  • 73
  • 136
Stefan
  • 2,603
  • 2
  • 33
  • 62
  • This heavily depends on the database you are using. In MySQL you could just run a `SHOW CREATE ` query to get the SQL, then parse that. `DESCRIBE ` is also useful. Often the DBI:: driver has some properties on your database handle that will tell you things, too. – simbabque Jul 13 '17 at 09:30
  • 1
    Related: https://stackoverflow.com/q/9855209/1331451 – simbabque Jul 13 '17 at 09:33
  • Thank you simbabque I think this helps me. – Stefan Jul 13 '17 at 09:45
  • 1
    Check the duplicate. I think that's it. You can just run that query. My Oracle admin buddy found that answer for me. – simbabque Jul 13 '17 at 09:46

0 Answers0