Oracle case sensitive Format SQL
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.
Just use the CREATE statement as-is. The tables will be created so that all the following will work just fine:
select AuditTrail from DPAuditTrailDetail where ID=1;
select AUDITTRAIL from DPAUDITTRAILDETAIL where ID=1;
select aUdITtraIL from dpaudittraildetaiL where id=1;
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
精彩评论