0
I am trying to create a table in apex5 with reference, possessing foreign key from another table and that this foreign key column is populated. But creating is returning the error:
ORA-00922: Missing or invalid option
Have I checked and not noticed any error in Omega what may be going wrong? Follow the code:
CREATE TABLE "IMAGEM_ICONE_SISTEMA"
( "COD" NUMBER NOT NULL ENABLE,
"COD_SISTEMA" NUMBER(6,0) NOT NULL ENABLE,
"NOME" VARCHAR2(55),
"ARQUIVO_IMAGEM" BLOB,
"MIMETYPE" VARCHAR2(255),
"FILENAME" VARCHAR2(400),
"IMG_LAST_UPDATE" TIMESTAMP (6) WITH LOCAL TIME ZONE,
"UPDATED_BY" VARCHAR2(55),
"TEXTO_DESCRICAO" VARCHAR2(55),
"LINK" VARCHAR2(2000),
"NUM_ORDEM" NUMBER(6,0),
CONSTRAINT "IMAGEM_ICONE_SISTEM_PK" PRIMARY KEY ("COD") USING INDEX ENABLE
)
/
ALTER TABLE "IMAGEM_ICONE_SISTEMA" ADD CONSTRAINT "IMAGEM_ICONE_SISTEMA_FK" FOREIGN KEY ("COD_SISTEMA")
REFERENCES "APEX_SISTEMA" ("COD") ON DELETE CASCADE ENABLE
/
CREATE INDEX "IMAGEM_ICONE_SISTEMA_I2" ON "IMAGEM_ICONE_SISTEMA" ("COD_SISTEMA")
/
CREATE OR REPLACE EDITIONABLE TRIGGER "BI_IMAGEM_ICONE_SISTEMA"
before insert or update on IMAGEM_ICONE_SISTEMA
for each row
begin
if :new.COD is null then
select to_number(sys_guid(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') into :new.cod from dual;
end if;
if inserting then
:new.img_last_update := localtimestamp;
:new.updated_by := nvl(wwv_flow.g_user,user);
elsif updating and :new.filename is not null and nvl(dbms_lob.getlength(:new.arquivo_imagem),0) > 15728640 then
raise_application_error(-20000, 'O tamanho do arquivo enviado foi maior do que 15MB . Faça o upload de um arquivo de tamanho menor.');
end if;
if (inserting or updating) and :new.filename is not null and nvl(:new.mimetype,'NULL') not like 'image%' then
raise_application_error(-20000, 'O arquivo enviado não é uma imagem. Faça o upload de um arquivo de imagem.');
end if;
if inserting or updating then
:new.img_last_update := localtimestamp;
:new.updated_by := nvl(wwv_flow.g_user,user);
end if;
end;
/
ALTER TRIGGER "BI_TB_DOC_IMAGEM_ICONE_SISTEMA" ENABLE
/
What version of Oracle?
– David
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production PL/SQL Release 12.1.0.2.0 - Production
– Fagner Rodrigues
Hello. I was able to solve the problem. The problem is that in Apex the commands must be given one by one. Command by command has been compiling. But I had the same error while compiling Rigger, but I was able to locate the problem. The Rigger problem was because of the EDITIONABLE keyword, without it it compiled smoothly and Rigger was created as well. I thank those who tried to help.
– Fagner Rodrigues
I thought you were wanting to use the EDITIONABLE that is in the 12c documentation, of course there should be
EDITIONING
, but I didn’t get to the bottom, follow -> (https://oracle-base.com/articles/11g/edition-based-redefinition-11gr2#editionable_objects)– David