0
I’m trying to create an index by command:
declare
cont integer;
tabela varchar2(100) := 'DECLARACAO_IMPORTACAO';
coluna varchar2(100) := 'DESPACHANTE_FK';
indice varchar2(100) := 'DECLARACAO_IMPORTACAODESPCHT1';
begin
select distinct count(index_name) into cont from user_ind_columns
where table_name = tabela and column_name = coluna;
if cont = 0 then
execute immediate 'create index '||indice||' on '||tabela||' ( '||coluna|| ')';
commit;
end if;
end;
/
But always returns me the error:
[2021-04-02 16:00:49] [42000][904]
[2021-04-02 16:00:49] ORA-00904: "DESPACHANTE_FK": invalid identifier
[2021-04-02 16:00:49] ORA-06512: at line 10
[2021-04-02 16:00:49] Position: 0
It seems to be a syntax problem but I don’t know how to fix it.. Someone please give a help?
Does the column exist in the table ? Does a dbms_output of the command.
– Motta
There is, blz. I’ll see
– Roknauta