Skip to content

Instantly share code, notes, and snippets.

@ArtDu
Created October 28, 2025 07:39
Show Gist options
  • Select an option

  • Save ArtDu/30e6ce4eaf1b07e3320605dcc95a9c8b to your computer and use it in GitHub Desktop.

Select an option

Save ArtDu/30e6ce4eaf1b07e3320605dcc95a9c8b to your computer and use it in GitHub Desktop.
select pk from oracle database
SELECT acc.column_name
FROM all_constraints ac
JOIN all_cons_columns acc
ON ac.owner = acc.owner
AND ac.constraint_name = acc.constraint_name
WHERE ac.table_name = 'YOUR_TABLE_NAME'
AND ac.constraint_type = 'P'
AND ac.owner = 'YOUR_SCHEMA_NAME';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment