Error naming check type Constraint

Asked

Viewed 45 times

1

Hello, I’m sorry if my question is too trivial or if I’m missing some important information, but I’m trying to create a Constraint type check giving a specific name to it, but gives the following error:

ORA-00906: parêntese esquerdo não encontrado
00906. 00000 -  "missing left parenthesis"

If I simply create this Constraint without giving a name and leave this task in charge of the system itself, the instruction runs smoothly. I already searched the forums, but I did not find the answer to my question, because the problems related to the above error are all directed to search instructions.

Can you explain why the above code was wrong? And how could I make it work? Thanks in advance!

The error code is this:

ALTER TABLE instalacao_periferico ADD CHECK chk_hora_desinstalacao 
(dt_hora_desinst_perif >= dt_hora_inst_perif);

The code that makes no mistake is this:

ALTER TABLE instalacao_periferico ADD CHECK (dt_hora_desinst_perif >= 
dt_hora_inst_perif);
  • 1

    The name of the Constraint comes before , examples in http://dba-oracle.com/t_alter_table_add_constraint_syntax_example.htm

  • Thanks @Motta, in the example I gave, I ran the following code and it worked: ALTER TABLE instalacao_periferico ADD CONSTRAINT chk_hora_desinstalacao CHECK (dt_hora_desinst_perif >= dt_hora_inst_perif);

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.