How to use Oracle PL/SQL to Comment a Table Or column

Our database is uncommented. I would like to embed table and column comments.

What is the syntax?

is it something like ALTER Table MyTable comment = "my table comment" ?

is it something like ALTER Table MyTable, Column MyColumn comment = "my column comment" ?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
PL/SQL is the procedural language.

What you want is regular SQL.

The online docs have everything you need:

COMMENT ON COLUMN employees.job_id
   IS 'abbreviated job title';

The TABLE one is the same:
   IS 'some table comment';

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Devinder Singh VirdiLead Oracle DBA TeamCommented:
From PL/SQL, you need to use
execute immediate '.... DDL Command...'

  execute immediate 'comment on table temp_dev is ''This is Temp''';
slightwv (䄆 Netminder) Commented:
Don't use PL/SQL to do this.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

I see you've opened a similar question in another thread.  Here's the same code I posted there.

You can/should delete that other thread now

    p_owner     IN VARCHAR2,
    p_table     IN VARCHAR2,
    p_comment   IN VARCHAR2
        'comment on table "' || p_owner || '"."' || p_table || '" is ''' || p_comment || '''';

You might note I'm putting double quotes around the owner and table name.
That's to support mixed-cased object names and names with non-standard characters.

It's generally considered bad practice to have such names, but it's a good idea to support them.   If you don't need that you can either remove the double-quotes, or call the procedure with upper case names,  or wrap the parameters in UPPER() function in the concatenation
DovbermanAuthor Commented:
That helps.  Thanks,
looks like I was too late here on my cross post.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.