Wednesday, December 8, 2010

SQL Error: ORA-30649: missing DIRECTORY keyword

All I wanted to do was to add a column to a pre existing table in the Database and give it a default value.
My SQL was:

ALTER TABLE Table1
ADD Column1 VARCHAR2(1) not null default 'N';


I kept getting this error:



ORA-30649: missing DIRECTORY keyword
Cause: DEFAULT DIRECTORY clause missing or incorrect.
Action: Provide the DEFAULT DIRECTORY.


Well, google did not help. What is a default directory anyway? So I played with my SQL a little bit more and came up with:



ALTER TABLE Table1
ADD Column1 VARCHAR2(1) default 'N' not null;

It was just a sequence problem in the SQL Statement. Im a no SQL Expert and when I look at such Oracle error numbers it does nothing but confuse me.

3 comments:

Anonymous said...

Thanks, this post really helped.
I was able to trigger the query on mssql, oracle n mysql db:
ALTER TABLE Table1 ADD NewColumn NUMERIC(5) DEFAULT 0 NOT NULL;

So that new column is added to existing table and default value is set 0 for all rows.

Unknown said...

Thank you very much for your answer. It resolved my problem

Unknown said...

Hi,it was nice post. resolved my problem.