5

I want to alter a table to include modified and created columns. However, I am having trouble with adding the modified column. I get the following error:

SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis"

I was reading this Oracle document (http://docs.oracle.com/cd/E17952_01/refman-5.5-en/timestamp-initialization.html) to get an example on how to properly write the ON UPDATE syntax

Here is my SQL.

ALTER TABLE FOOBAR
ADD (
  created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
  modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

Why am I getting a missing right parenthesis error?

Evan Carroll
  • 65,432
  • 50
  • 254
  • 507
John F.
  • 207
  • 2
  • 4
  • 8

1 Answers1

7

That is the MySQL documentation, not the Oracle Database documentation. There is no such clause in Oracle Datababase. Use a trigger. Here is an example: link

Balazs Papp
  • 41,488
  • 2
  • 28
  • 47