Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does a vertical bar mean in a SQL function call?

Tags:

syntax

sql

I'm learning SQL, and a lot of the examples have | (vertical bar) in function parameters. What does it represent? Like this:

TRUNC(column|expression, decimal places)

between column and expression.

like image 233
Marty Avatar asked Jul 09 '26 17:07

Marty


2 Answers

It means "or". In that example you could have a column name or an expression.

like image 160
Marcie Avatar answered Jul 12 '26 08:07

Marcie


A typical method of defining or explaining a grammar is with Backus-Naur Form (BNF) or some variation that is usually much less formal. In BNF, definitions that can have one of two or more choices often show the valid choices separated by a vertical bar. The example you show says that a couple of valid uses of TRUNC are:

TRUNC( somecolumn, 5 )
TRUNC( colA * colB, 8 )
like image 29
Mark Wilkins Avatar answered Jul 12 '26 09:07

Mark Wilkins