PLS-00103 在 BEGIN ... END 块中使用 COMMENT 语句时出错 PL/SQL
PLS-00103 error when using COMMENT statement in BEGIN ... END block in PL/SQL
出于好奇,我试图在 PL/SQL 块中使用 COMMENT 语句。我在 Oracle 11g 数据库和 SQL Workshop 中使用 Oracle APEX 18.2 我能够自己执行命令,但是如果我将它包装在 BEGIN ... END 块中,那么我会收到一条错误消息,如:
ORA-06550: line 4, column 18: PLS-00103: Encountered the symbol "ON" when expecting one of the following: : = . ( @ % ;
有效命令示例:
COMMENT ON COLUMN employees.job_id IS 'comment';
导致错误消息的命令示例:
BEGIN
COMMENT ON COLUMN employees.job_id IS 'comment';
END;
我假设 COMMENT 不是存储过程中允许的语句,但我无法找到支持这一点的证据。我是对的吗?如果是的话,这在任何地方都有记录吗?
感谢@GMB 提供书面示例的回答。
考虑:
create table employees(job_id int);
begin
comment on column employees.job_id is 'comment'
end;
/
ora-06550: line 2, column 13:
pls-00103: encountered the symbol "on" when expecting one of the following:
:= . ( @ % ;
begin
execute immediate 'comment on column employees.job_id is ''comment''' ;
end;
/
1 rows affected
db<>fiddle here
出于好奇,我试图在 PL/SQL 块中使用 COMMENT 语句。我在 Oracle 11g 数据库和 SQL Workshop 中使用 Oracle APEX 18.2 我能够自己执行命令,但是如果我将它包装在 BEGIN ... END 块中,那么我会收到一条错误消息,如:
ORA-06550: line 4, column 18: PLS-00103: Encountered the symbol "ON" when expecting one of the following: : = . ( @ % ;
有效命令示例:
COMMENT ON COLUMN employees.job_id IS 'comment';
导致错误消息的命令示例:
BEGIN
COMMENT ON COLUMN employees.job_id IS 'comment';
END;
我假设 COMMENT 不是存储过程中允许的语句,但我无法找到支持这一点的证据。我是对的吗?如果是的话,这在任何地方都有记录吗?
感谢@GMB 提供书面示例的回答。
考虑:
create table employees(job_id int);
begin
comment on column employees.job_id is 'comment'
end;
/
ora-06550: line 2, column 13: pls-00103: encountered the symbol "on" when expecting one of the following: := . ( @ % ;
begin
execute immediate 'comment on column employees.job_id is ''comment''' ;
end;
/
1 rows affected
db<>fiddle here