Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hemantkchitale/c917d5f2790273de8dc854071049222b to your computer and use it in GitHub Desktop.
Save hemantkchitale/c917d5f2790273de8dc854071049222b to your computer and use it in GitHub Desktop.
Autonomous Comment in Oracle
set echo on
set pages600
set linesize 132
spool create_proc_autonomous_comment_ddl
create or replace procedure proc_autonomous_comment_ddl
(in_table_name in varchar , in_comment_28char in varchar)
is
pragma autonomous_transaction;
comment_table_name varchar(30);
comment_words varchar2(30);
command_string varchar(128);
begin
comment_table_name := in_table_name;
comment_words := in_comment_28char;
command_string := 'comment on table ' || comment_table_name || ' is ''' || comment_words || '''' ;
execute immediate command_string;
end;
/
show errors;
desc proc_autonomous_comment_ddl
spool off
@hemantkchitale
Copy link
Author

To be able to issue a COMMENT (a DDL) without actually doing an implicit COMMIT in the current transaction. The COMMENT can invalidate SQLs against the underlying table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment