[odb-users] Quoted database names in Oracle
boris at codesynthesis.com
Wed Aug 4 10:11:24 EDT 2021
Adam Walters <awalters at spsy.com> writes:
> I would like to replace some ancient Oracle database code in an application
> with a nice ODB-based implementation but one of the problems I have
> encountered is the default behaviour of ODB to use quotes around table
> names (tables, columns, etc.). Since I am trying to make this replacement
> as close as possible, I would like to retain the existing database
> convention that uses no quotes around the objects.
> I tried using the --table-regex etc. options but they do not appear
> to be able to remove the quotes from the resulting names of database
Right, quoting happens after this processing.
> Obviously, just changing the schema generation sql to remove the quotes
> results in the desired naming but won't work with ODB after that. Is
> there a way to create the database entities without quotes by passing
> an option to the ODB complier?
No, there is no such option. In Oracle an unquoted identifier is
capitalized while a quoted one is used as is. So if you want to
reference an unquoted identifier but spelled quoted, you have to
capitalize it yourself. For example:
CREATE TABLE bar ...
select * from bar -- OK
select * from BAR -- OK
select * from "bar" -- ERROR
select * from "BAR" -- OK
So one way to achieve what you want would be to use --*-regex to
capitalize all the identifiers (there is the \U modifier for that).
Alternatively, you can assign already capitalized table and column
names using pragmas.
More information about the odb-users