oracle table comment

COMMENT ON TABLE table_name IS 'A table comment';
COMMENT ON COLUMN table_name.MY_COLUMN IS 'A column comment';

SELECT * FROM ALL_TAB_COMMENTS WHERE TABLE_NAME = 'TABLE_NAME';
SELECT * FROM ALL_COL_COMMENTS WHERE TABLE_NAME = 'TABLE_NAME';

3.86
7

                                    COMMENT ON COLUMN TABLE_NAME.MY_COLUMN IS 'A column comment';
SELECT * FROM ALL_COL_COMMENTS WHERE TABLE_NAME = 'TABLE_NAME';
-- All schema columns:
SELECT t.OWNER, t.TABLE_NAME, c.COLUMN_NAME, com.COMMENTS
FROM DBA_TABLES t LEFT JOIN DBA_TAB_COLUMNS c
    ON c.OWNER = t.OWNER AND c.TABLE_NAME = t.TABLE_NAME
LEFT JOIN DBA_COL_COMMENTS com ON com.OWNER = c.OWNER AND com.TABLE_NAME = c.TABLE_NAME
    AND com.COLUMN_NAME = c.COLUMN_NAME
WHERE t.OWNER = 'MY_OWNER' AND t.DROPPED = 'NO'
ORDER BY t.OWNER, t.TABLE_NAME, c.COLUMN_NAME;

3.86 (7 Votes)
0
3.5
4
Pennatus 50 points

                                    SELECT * FROM ALL_TAB_COMMENTS WHERE TABLE_NAME = 'MY_TABLE';  -- Table comment
SELECT * FROM ALL_COL_COMMENTS WHERE TABLE_NAME = 'MY_TABLE';  -- Columns comments

-- All owner tables:
SELECT t.OWNER, t.TABLE_NAME, com.COMMENTS
FROM DBA_TABLES t
LEFT JOIN DBA_TAB_COMMENTS com ON com.OWNER = t.OWNER AND com.TABLE_NAME = t.TABLE_NAME
WHERE t.OWNER = 'TRANSFERT_DOAAT' AND t.DROPPED = 'NO'
ORDER BY t.OWNER, t.TABLE_NAME;

3.5 (4 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source