Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of $$ sign in table name in Oracle Database

Tags:

sql

oracle

I get to maintain a application which use $$ sign as prefix and suffix to some word in the table create statement - Oracle DB. like

create table $$temp$$(id int)

For testing purpose I ran the statement in SQL plus but it threw invalid character error and so I had to remove $$ sign and then it ran as expected.

Is there a specific use for $$? some thing related to session ?

like image 893
Shiva Avatar asked Dec 16 '22 03:12

Shiva


1 Answers

Is there a specific use for $$

No there is not. Dynamic performance views, however, have one dollar sign ($) in their names, v$sql, for example. It's Oracle's choice to name them that way.

You won't be able create a table, which name starts with dollar sign($), simply because any non-quoted identifier should begin with an alphabetic character. You can however force Oracle to accept an identifier that begins with a non-alphabetic character if you enclose it with double quotation marks, like so

create table "$$temp$$"(
  id int
)

but it should be noted that when you created a table using double quotation marks, you made that table name case-sensitive (unless you didn't type the table name in uppercase) and would always have to use double quotation marks when referencing that table.

like image 172
Nick Krasnov Avatar answered Jan 05 '23 01:01

Nick Krasnov