Oracle 10G 不区分大小写的列
Oracle 新手:
我刚刚开始创建我的第一个 Oracle 数据库表。 我已经下载了 Oracle 10G Express Edition
CREATE TABLE "EMPLOYEE_INFO"
( "ID" NUMBER(5,0) NOT NULL ENABLE,
"FIRST_NAME" VARCHAR2(50),
"LAST_NAME" VARCHAR2(50),
"SEX" VARCHAR2(1),
"BIRTHDAY" DATE,
CONSTRAINT "EMPLOYEE_INFO" PRIMARY KEY ("ID") ENABLE
)
有没有办法使表“不区分大小写”? 我注意到当您在 SEX = 'm' 列中插入数据并且 我执行这样的查询
select * from
EMPLOYEE_INFO where
sex = 'M';
不会返回任何数据。
抱歉,如果我的问题非常初级,这是我第一次使用 Oracle DB。 谢谢
Oracle Newbie Here:
I just started out creating my first Oracle database table.
I have downloaded the Oracle 10G Express Edition
CREATE TABLE "EMPLOYEE_INFO"
( "ID" NUMBER(5,0) NOT NULL ENABLE,
"FIRST_NAME" VARCHAR2(50),
"LAST_NAME" VARCHAR2(50),
"SEX" VARCHAR2(1),
"BIRTHDAY" DATE,
CONSTRAINT "EMPLOYEE_INFO" PRIMARY KEY ("ID") ENABLE
)
Is there a way that I could make the table "case-insensitive"?
I notice that when you insert data in the column SEX = 'm' and
I perform a query such as
select * from
EMPLOYEE_INFO where
sex = 'M';
This does not return any data.
Sorry if my question is very elementary, its my first time to use Oracle DB.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以尝试使用upper(或lower):
但是要小心,如果你有性别索引,你会失去它!如果您的性别列是大小写混合的并且您需要一个函数,您可以在 UPPER(SEX) 或 LOWER(SEX) 上创建基于函数的索引。
如果“M”也可以是小写,则还需要添加大写:
You can try with upper (or lower):
But be careful, if you have an index in sex, you will lose it! If your sex column is mixed case and you need a function, you can create a Function Based Index on either UPPER(SEX) or LOWER(SEX).
If 'M' can be a lower case too, you need to add upper too: