Reputation: 1672
I have created a table users
create table users (
id int,
name varchar(40)
);
Now i want a default value for name
This query works in MYSQL but not in Oracle database 11g XE
alter table users alter name set default 'user';
Can anyone explain why ?
Upvotes: 1
Views: 58
Reputation: 349
I think the correct query will be like this:
ALTER TABLE users MODIFY name VARCHAR(40) NOT NULL DEFAULT 'user';
Upvotes: 0
Reputation: 107387
The syntax for adding a default to an existing column is different in Oracle, viz:
alter table users
modify (name default 'user');
Upvotes: 1