0
I am making a condition to add a field in the database, IE, will only add if the condition is equal to 0. The problem is that in my instruction execute immediate
He says the word PRIMARIO is invalid. This is because it should be with simple quotes('') but how can I treat this since all the query is already with quotes ? Detail: If it is a number works since it does not need quotes.
declare
col_count integer;
begin
select count(*)
into col_count
from user_tab_columns
where table_name = 'BALANCA'
and column_name = 'TIPO';
if col_count = 0 then
execute immediate 'ALTER TABLE BALANCA ADD TIPO varchar2(255 char) default PRIMARIO not null';
commit;
end if;
end;