Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL ALTER TABLE with default [closed]

Tags:

sql

oracle

I'm trying to alter a table in Oracle. I have to give a column in a table a default value of 1. This is simple enough when making the table but I have to do it using the ALTER TABLE feature, This is what I have:

 ALTER TABLE Stock_Qty
 ADD CONSTRAINT Qty_DEFAULT_Value DEFAULT (Qty 1);

It doesn't seem to work.

like image 369
user1756421 Avatar asked Nov 17 '12 22:11

user1756421


People also ask

How do I set default value in query?

Select the column for which you want to specify a default value. In the Column Properties tab, enter the new default value in the Default Value or Binding property. To enter a numeric default value, enter the number. For an object or function enter its name.


1 Answers

Here's the correct syntax:

ALTER TABLE Stock_Qty
MODIFY Qty DEFAULT 1
like image 131
ron tornambe Avatar answered Sep 28 '22 06:09

ron tornambe