Oracle 区分大小写 SQL 格式
我需要为 Oracle Db 格式化 SQL 语句。我有一个sql语句,我不想改变大小写。对于例如。
CREATE TABLE DPAuditTrailDetail
(
ID NUMBER (19, 0) DEFAULT 0 NOT NULL,
AuditTrail NUMBER (19, 0) DEFAULT 0 NOT NULL,
sysObjectField NUMBER (19, 0) DEFAULT 0 NOT NULL,
OldValue NCLOB DEFAULT NULL ,
NewValue NCLOB DEFAULT '' NOT NULL,
Referenced NUMBER (19, 0) DEFAULT NULL
);
我相信,要在 Oracle 中创建具有此表名和列名的表,我必须为每个名称添加双引号(“”)。我有一个很大的剧本,我想尽快完成。
请建议一些快速的方法来做到这一点。
谢谢。
I need to format SQL statement for Oracle Db. I have a sql statement and I don't want to change the case. For Eg.
CREATE TABLE DPAuditTrailDetail
(
ID NUMBER (19, 0) DEFAULT 0 NOT NULL,
AuditTrail NUMBER (19, 0) DEFAULT 0 NOT NULL,
sysObjectField NUMBER (19, 0) DEFAULT 0 NOT NULL,
OldValue NCLOB DEFAULT NULL ,
NewValue NCLOB DEFAULT '' NOT NULL,
Referenced NUMBER (19, 0) DEFAULT NULL
);
I believe, to create table with this table name and column names in oracle, i will have to add double quotes("") to each name. I have a big script and I would like to do it as quick as possible.
Please do suggest some quick way to do it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需按原样使用 CREATE 语句即可。这些表将被创建,以便以下所有功能都能正常工作:
Oracle 查询默认情况下不区分大小写,如果您坚持此默认设置,您的生活(以及您离开后维护代码的人员的生活)将会更轻松。
Just use the CREATE statement as-is. The tables will be created so that all the following will work just fine:
Oracle queries are case-insensitive by default and your life (and that of those maintaining your code when you're gone) will be easier if you stick to this default.
如果确实必须使用区分大小写的表/列名称,唯一的方法是在表/列名称中添加双引号。但正如评论者所说,使用区分大小写的名称并不是一个好习惯
If you really have to use case-sensitive table/column names, the only way is to add double-quotes to table/column names. But as the commenters said, it's not good practice to use case-sensitive names