问题,谢谢。

jackedfang 2003-02-12 03:57:20
SQL> create table "countries"
2 ("country_id"char(2 byte)not null,
3 "country_name"varchar2(40 byte)not null,
4 "country_subregion"varchar2(30 byte),
5 "country_region"varchar2(20 byte)not null)
6 ;

表已创建。
SQL> insert into countries
2 (country_id,country_name,country_subregion,country_region)
3 values('cn','china pr','eastern asia','asia')
4 ;
insert into countries
*
ERROR 位于第 1 行:
ORA-00942: 表或视图不存在


为什么啊?
BTW:在sqlplus中怎么修改写错了的sql语句?难道非要重写吗?
...全文
40 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
Fred_Mark 2003-02-12
  • 打赏
  • 举报
回复
同意beckhambobo(beckham),当然你也可以加上双引号来控制表名的大小,不过以后再应用程序中再对该表操作时就不方便了,还是不要这样做得好。
beckhambobo 2003-02-12
  • 打赏
  • 举报
回复
建什么对象,最好不要在对象名加双引号,引起麻烦。
tuidler 2003-02-12
  • 打赏
  • 举报
回复
desc 一下你的表结构吧, DESC TABLENAME
正常建立表的话,不应该有这个错误
wjlj1234 2003-02-12
  • 打赏
  • 举报
回复
up
insert into "countries" ("country_id","country_name","country_subregion","country_region")
values('cn','china pr','eastern asia','asia');
表名加引号。
jackedfang 2003-02-12
  • 打赏
  • 举报
回复
在sqlplus中,单引号和双引号的具体使用可以说说吗?
jackedfang 2003-02-12
  • 打赏
  • 举报
回复
谢谢大家,尤其谢谢 beckhambobo(beckham)
jackedfang 2003-02-12
  • 打赏
  • 举报
回复
SQL> insert into countries
2 (country_id,country_name,country_subregion,country_region)
3 values('cn','chinapr','easternasia','asia')
4 ;
(country_id,country_name,country_subregion,country_region)
*
ERROR 位于第 2 行:
ORA-00904: "COUNTRY_REGION": 无效的标识符

我已经把countries的引号去掉了。
怎么这么难啊,急死了。wuwu~~~
beckhambobo 2003-02-12
  • 打赏
  • 举报
回复
不加引号oracle默认为大写,现在控制它的大小写。

SQL> create table "countries"
2 ("country_id"char(2)not null,
3 "country_name"varchar2(40)not null,
4 "country_subregion"varchar2(30),
5 "country_region"varchar2(20)not null);

Table created
SQL> insert into "countries"
2 ("country_id","country_name","country_subregion","country_region")
3 values('cn','china pr','eastern asia','asia');

1 row inserted

SQL> select * from "countries";

country_id country_name country_subregion country_region
---------- ---------------------------------------- ------------------------------ --------------------
cn china pr eastern asia asia
jiezhi 2003-02-12
  • 打赏
  • 举报
回复
使用命令edit
gongjan 2003-02-12
  • 打赏
  • 举报
回复
为什么要加引号?估计是引号的问题。
sqlplus编辑起来是不太方便,可以在别的文本编辑器中编辑,
copy到sqlplus中执行
Lastdrop 2003-02-12
  • 打赏
  • 举报
回复
你创建的表是"countries",而不是countries。

在sql*plus中要修改sql语句可以调用edit命令,在文本中修改,也可以利用命令

insert into countries
2 (country_id,country_name,country_subregion,country_region)
3 values('cn','china pr','eastern asia','asia')
4 ;
例如想修改第3行的cn为en
SQL> l3

SQL> c/cn/en


17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧