如何使用CREATE或REPLACE? [英] How do I use CREATE OR REPLACE?
问题描述
我是否正确理解CREATE OR REPLACE的基本含义是如果对象存在,则将其删除,然后以任何一种方式创建它?"
Am I correct in understanding that CREATE OR REPLACE basically means "if the object exists, drop it, then create it either way?"
如果是这样,我在做什么错?这有效:
If so, what am I doing wrong? This works:
CREATE TABLE foo (id NUMBER,
title VARCHAR2(4000) DEFAULT 'Default Title')
这不是(ORA-00922:缺少或无效的选项):
And this doesn't (ORA-00922: missing or invalid option):
CREATE OR REPLACE TABLE foo (id NUMBER,
title VARCHAR2(4000) DEFAULT 'Default Title')
我在做蠢事吗?我似乎找不到太多有关此语法的文档.
Am I doing something stupid? I don't seem to be able to find much documentation about this syntax.
推荐答案
这适用于函数,过程,包,类型,同义词,触发器和视图.
This works on functions, procedures, packages, types, synonyms, trigger and views.
更新:
第三次更新帖子后,我将其重新表述:
After updating the post for the third time, I'll reformulate this:
这不适用于表:)
This does not work on tables :)
是的,有 文档 ,并且CREATE TABLE
没有REPLACE
选项.
这篇关于如何使用CREATE或REPLACE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!