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.
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.
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.
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.
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.
This is not a valid Oracle SQL nor PL/SQL.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With