Yulia P
Yulia P

Reputation: 3

Oracle: Invalid ALTER command in execute immediate

In the procedure, in the ALTER command, I need to dynamically substitute the name of the trigger that needs to be activated.

declare 
v_trg_name varchar2(25) := 'article_comment_audit';
begin 
execute immediate 'ALTER TRIGGER' || v_trg_name || 'ENABLE';
end;

I try to run this code, but it returns an error ORA-00940 invalid ALTER command Please tell me what is the problem?

Upvotes: 0

Views: 103

Answers (1)

Thorsten Kettner
Thorsten Kettner

Reputation: 95080

You'll get 'ALTER TRIGGERarticle_comment_auditENABLE'.

Insert Blanks:

'ALTER TRIGGER ' || v_trg_name || ' ENABLE';

in order to get 'ALTER TRIGGER article_comment_audit ENABLE'.

Upvotes: 2

Related Questions