开发者

What's the significance of # in SQL?

开发者 https://www.devze.com 2023-03-03 10:05 出处:网络
I have the following code to create an object type in Oracle (PL??) CREATE OR REPLACE TYPE STAFF开发者_如何学Go_T as OBJECT(Staff_ID# NUMBER, Person PERSON_T); \\

I have the following code to create an object type in Oracle (PL??)

CREATE OR REPLACE TYPE STAFF开发者_如何学Go_T as OBJECT(Staff_ID# NUMBER, Person PERSON_T); \

I'd like to know what is the significance of the # appended to the Staff_ID variable in the declaration?


No special meaning.

Oracle allows using $, _ and # in identifiers, just like any other alphanumeric characters, but the identifier should begin with an alpha character (a letter).


That's part of the column name Staff_ID#. The pound sign is an allowable part of an identifier (table/column name) in PL/SQL. See here


Whoever wrote the code probably didn't mean anything special by #.

But # apparently means something to Oracle, although I don't know what. From the SQL Language Reference:

Oracle strongly discourages you from using $ and # in nonquoted identifiers.

Here are some guesses for what the warning is about:

  • it's related to a really old bug (the warning goes back to at least Oracle 7)
  • Oracle plans to do something with it in a future verison
  • that character isn't available on all keyboards, character sets, or platforms that Oracle supports

The data dictionary uses the number sign a lot, and as far as I can tell it works just fine for user objects. But just to be safe you might want to remove it.

0

精彩评论

暂无评论...
验证码 换一张
取 消