oracle-comment on的用法

本文详细介绍了Oracle数据库中使用COMMENT ON命令为表和字段添加注释的方法。包括如何为表和列添加、查看及删除注释,以及相关视图的使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载:https://blog.youkuaiyun.com/wangmuming/article/details/28878461
oracle中用comment on命令给表或字段加以说明,语法如下:
COMMENT ON
{ TABLE [ schema. ]
{ table | view }
| COLUMN [ schema. ]
{ table. | view. | materialized_view. } column
| OPERATOR [ schema. ] operator
| INDEXTYPE [ schema. ] indextype
| MATERIALIZED VIEW materialized_view
}
IS ‘text’ ;

用法如下:
1.对表的说明
comment on table table_name is ‘comments_on_tab_information’;

2.对表中列的说明
comment on column table.column_name is ‘comments_on_col_information’;

3.查看表的说明
SQL> select * from user_tab_comments where TABLE_NAME=’EMPLOYEES’;

TABLE_NAME TABLE_TYPE COMMENTS


EMPLOYEES TABLE 员工表

SQL> select * from user_tab_comments where comments is not null;

TABLE_NAME TABLE_TYPE COMMENTS


EMPLOYEES TABLE 员工表

4.查看表中列的说明
SQL> select * from user_col_comments where TABLE_NAME=’EMPLOYEES’;

TABLE_NAME COLUMN_NAME COMMENTS


EMPLOYEES EMPLOYEE_ID
EMPLOYEES MANAGER_ID
EMPLOYEES FIRST_NAME
EMPLOYEES LAST_NAME
EMPLOYEES TITLE
EMPLOYEES SALARY 员工薪水

SQL> select * from user_col_comments where comments is not null;

TABLE_NAME COLUMN_NAME COMMENTS


EMPLOYEES SALARY 员工薪水

5.我们也可以从下面这些视图中查看表级和列级说明:
ALL_COL_COMMENTS
USER_COL_COMMENTS
ALL_TAB_COMMENTS
USER_TAB_COMMENTS

6.删除表级说明,也就是将其置为空
SQL> comment on table employees is ”;
Comment added

SQL> select * from user_tab_comments where TABLE_NAME=’EMPLOYEES’;

TABLE_NAME TABLE_TYPE COMMENTS


EMPLOYEES TABLE

7.删除列级说明,也是将其置为空
SQL> comment on column employees.salary is ”;
Comment added

SQL> select * from user_col_comments where TABLE_NAME=’EMPLOYEES’;

TABLE_NAME COLUMN_NAME COMMENTS


EMPLOYEES EMPLOYEE_ID
EMPLOYEES MANAGER_ID
EMPLOYEES FIRST_NAME
EMPLOYEES LAST_NAME
EMPLOYEES TITLE
EMPLOYEES SALARY

./bin/flink run -d -t yarn-per-job \ -Dyarn.application.name="flinkcdc_prod_old_smpcdb_3" \ -Dyarn.application.queue="hive" \ -Dstate.backend=rocksdb \ -Dstate.externalize-checkpoints=true \ -Dexecution.checkpointing.externalized-checkpoint-retention=RETAIN_ON_CANCELLATION \ -Dexecution.checkpointing.interval=180s \ -Dexecution.checkpointing.timeout=7200s \ -Dexecution.checkpointing.min-pause=60s \ -Dexecution.checkpointing.max-concurrent-checkpoints=1 \ -Dstate.checkpoints.dir=hdfs://hadoop102:8020/flink_ck/offline/prod_old_smpcdb \ --allowNonRestoredState \ -Dparallelism.default=4 \ -Djobmanager.memory.process.size=2048m \ -Dtaskmanager.memory.process.size=5120m \ -Dtaskmanager.numberOfTaskSlots=2 \ -c org.apache.doris.flink.tools.cdc.CdcTools \ /opt/module/flink-1.17.2-sql-cdc/lib/flink-doris-connector-1.17-1.6.2.jar \ oracle-sync-database \ --database prod_old_smpcdb \ --oracle-conf hostname=10.1.9.2 \ --oracle-conf port=1521 \ --oracle-conf database-name=PMS2 \ --oracle-conf username=pms \ --oracle-conf password="SRX3yak#8" \ --oracle-conf schema-name=PMS \ --oracle-conf debezium.database.history.store.only.captured.tables.ddl=true \ --oracle-conf debezium.log.miner.enabled=false \ --oracle-conf debezium.snapshot.mode=initial_only \ --oracle-conf debezium.snapshot.fetch.size=20000 \ --oracle-conf debezium.column.mapping="CLOB:STRING,BLOB:STRING" \ --oracle-conf debezium.snapshot.checkpoint.interval.ms=0 \ --oracle-conf debezium.transforms=encodeBlob \ --oracle-conf debezium.transforms.encodeBlob.format=base64 \ --oracle-conf debezium.database.url="jdbc:oracle:thin:@//10.1.9.2:1521/PMS" \ --including-tables "EXP_PHOTO" \ --sink-conf fenodes=10.210.31.92:18030 \ --sink-conf username=root \ --sink-conf password=zjj000000 \ --sink-conf jdbc-url=jdbc:mysql://10.210.31.92:9030 \ --sink.buffer-size=100M \ --sink.buffer-flush.interval=60000 \ --sink-conf sink.enable-2pc=false \ --sink-conf sink.label-prefix=label_cdc_prod_old_smpcdb_340 \ --sink-conf sink.stream-load.timeout=7200 \ --sink-conf sink.connect.timeout.ms=60000 \ --sink-conf sink.request.timeout.ms=3600000 \ --table-conf replication_num=1 目前是flink doris connetct 来采集表中大字段
最新发布
07-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值