ALTER TABLE florabank_online.provision
ADD ( ln_classified_st VARCHAR2(3)
DEFAULT ” NOT NULL CONSTRAINT DF__interest_provision_ln_classified_st NOT NULL );
[Error] Execution (9: 73): ORA-00911: invalid character
What will be the right script.
Ripon Dutta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
If I understood well, you’re trying to add the column ln_classified_st
to the table florabank_online.provision
.
Besides specifying the column may not be null you also try to add the same constraint explicitly.
I guess you should try:
ALTER TABLE florabank_online.provision ADD ln_classified_st VARCHAR2(3) NOT NULL;
Not specifying a default value, this default value is automatically NULL.
Specifying NOT NULL you create the desired constraint.
If you want a named constraint then:
ALTER TABLE florabank_online.provision ADD (
ln_classified_st VARCHAR2(3)
DEFAULT NULL
CONSTRAINT DF__interest_provision_ln_classified_st NOT NULL
)
If you want an unnamed (or system-generate name) constraint then:
ALTER TABLE florabank_online.provision ADD (
ln_classified_st VARCHAR2(3)
DEFAULT NULL
NOT NULL
)
Note: In Oracle, ''
is identical to NULL
so DEFAULT ''
is the same as DEFAULT NULL
.
Note 2: The first- and last-brackets ()
in the statement are optional when you are adding a single column.
Note 3: If you are running the statement using EXECUTE IMMEDIATE
or via a third-party language (such as Java, Python, C#, etc.) then the invalid character is probably the ;
at the end of the statement. You should not include that in the statement. If you are running it as part of a script (i.e. in SQL*Plus, etc.) then you need statement terminators (i.e. ;
or /
on a newline) between statements but the trailing ;
is not part of the SQL statement.