Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What means square brackets in Oracle SQL query?

I find select statement with square brackets in it. Can anybody explain what does this brackets means?

e.g.

select a,b,[c] from table1;

Thanks.

like image 716
Ishikawa Yoshi Avatar asked Jul 31 '12 14:07

Ishikawa Yoshi


People also ask

What is [] in SQL query?

The brackets are required if you use keywords, spaces, hyphens or special chars in the column names or identifiers. Using square brackets in SQL Statements allow the names to be parsed correctly.

What are square brackets used for?

Square brackets, often just called brackets in American English, are a set of punctuation marks that are most often used to alter or add information to quoted material.

How do you handle special characters in Oracle SQL query?

Use braces to escape a string of characters or symbols. Everything within a set of braces in considered part of the escape sequence. When you use braces to escape a single character, the escaped character becomes a separate token in the query. Use the backslash character to escape a single character or symbol.

What is parenthesis in Oracle?

When working with Oracle SQL, all left parenthesis (the “(” character) must be paired with a right parenthesis character (the “)” character). If there are more left parentheses than right parentheses, then you'll get this error. It can also be caused by syntax errors in your CREATE TABLE statement.


2 Answers

This is not a valid Oracle SQL nor PL/SQL.

like image 56
Dmitriy Korobskiy Avatar answered Sep 20 '22 16:09

Dmitriy Korobskiy


According to oracle's documentation: http://docs.oracle.com/cd/B10500_01/text.920/a96518/cqspcl.htm

The bracket characters serve to group terms and operators found between the characters; however, they prevent penetrations for the expansion operators (fuzzy, soundex, stem).

Its a grouping character in the query.

like image 42
Noah Avatar answered Sep 22 '22 16:09

Noah