4.3.1. Using Positional Notation

4.3.1. Using Positional Notation
4.3.1.使用位置表示法
Positional notation is the traditional mechanism for passing arguments to functions in PostgreSQL.  An example is:
位置表示法是PostgreSQL为函数传参的传统机制。示例如下:
 
SELECT concat_lower_or_upper('Hello', 'World', true);
concat_lower_or_upper
-----------------------
HELLO WORLD
(1 row)
 
All arguments are specified in order. The result is upper case since uppercase is specified as true . Another example is:
所有的参数都按序指定。因为uppercase指定为true,所以返回大写。另一个示例:
 
SELECT concat_lower_or_upper('Hello', 'World');
concat_lower_or_upper
-----------------------
hello world
(1 row)
 
Here, the uppercase parameter is omitted, so it receives its default value of false , resulting in  lower case output. In positional notation, arguments can be omitted from right to left so long as they  have defaults.
上例中,为指定uppercase参数值,所以为默认值false,因此返回的为小写。在位置表示法中,参数如果有默认值,则可以从右到左忽略。
发布了341 篇原创文章 · 获赞 53 · 访问量 88万+

猜你喜欢

转载自blog.csdn.net/ghostliming/article/details/104307601