简体   繁体   English

Oracle SQL - 无效的更改表选项

[英]Oracle SQL- Invalid Alter Table Option

I have created the table below, The column with Payment status uses numbers (1&0) to display status of payments 1 if received and 0 if not.我创建了下表,“付款状态”列使用数字 (1&0) 显示付款状态,如果收到则为 1,否则为 0。 I filled up some of the lines with data.我用数据填充了一些行。 However I decided to use (Paid, Not Paid) instead of (1, 0).但是我决定使用 (Paid, Not Paid) 而不是 (1, 0)。 I tried to perform Alter table and I got this error : ORA-01735: invalid ALTER TABLE option 01735. 00000 - "invalid ALTER TABLE option".我尝试执行Alter table ,但出现此错误:ORA-01735: invalid ALTER TABLE option 01735. 00000 - "invalid ALTER TABLE option"。 I know this happens because the datatype in the table is set to numbers and already filled with numbers, but what is the easiest way to resolve this issue ?我知道发生这种情况是因为表中的数据类型设置为数字并且已经填充了数字,但是解决此问题的最简单方法是什么?

Thank you谢谢

Name                    Null?    Type         
----------------------- -------- ------------ 
OWNER_NAME                       VARCHAR2(20) 
APARTMENT_NUMBER                 VARCHAR2(4)  
TELEPHONE_NUMBER                 VARCHAR2(15) 
MONTH_YEAR                       VARCHAR2(6)  
FEE                              NUMBER       
PAYMENT_STATUS          NOT NULL NUMBER(1)    
MONEY_HANDED_TO_COMMITY          VARCHAR2(3)  

There's no "easy" way.没有“简单”的方法。

  • Create a new column创建一个新列
  • update table and set new column's value (depending on those 0/1)更新表并设置新列的值(取决于那些 0/1)
  • drop the old column删除旧列
  • rename the new column to old name将新列重命名为旧名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM