Adding a default constraint in Oracle while altering a column I'm new to Oracle. I need to port a SQL Server command to Oracle.

I want to alter a column to add a new constraint with a default value.

SQL Server command

ALTER TABLE &lt;schema_name&gt;.&lt;table_name&gt; 
ADD CONSTRAINT [&lt;constraint_name&gt;]
DEFAULT (1) FOR [&lt;column_name&gt;]


Oracle command

ALTER TABLE &lt;table_name&gt;
ADD CONSTRAINT &lt;constraint_name&gt; 
DEFAULT (1) FOR &lt;column_name&gt;


I get the following error when running the Oracle query:


Error report - 
SQL Error: ORA-00904: : invalid identifier
00904. 00000 -  "%s: invalid identifier"
*Cause:    
*Action:



It might be because FOR is an invalid identifier?

But then how do I add a constraint with a default value for a specific column?

Do we need to alter a column and set the default value?

Which is the right way to do this?
A default value is not a constraint in Oracle. You simply alter the column as:

SQL&gt; create table tab1 (col1 number, col2 number);

Table created.

SQL&gt; alter table tab1 modify (col2 default 1);

Table altered.

SQL&gt; select * from user_constraints;

no rows selected

SQL&gt; insert into tab1 (col1) values (0);

1 row created.

SQL&gt; select * from tab1;

      COL1       COL2
---------- ----------
         0          1