跳转到内容

返回由字符串 str 重复 count 次组成的字符串。如果 count 小于 1,则返回空字符串。如果 str 或 count 为 NULL,则返回 NULL。

func.repeat(<str>, <count>)
func.repeat(<str>, <count>)
┌─────────────────────────┐
│ func.repeat('plaid', 3) │
├─────────────────────────┤
│ plaidplaidplaid │
└─────────────────────────┘
REPEAT(<str>, <count>)
参数 说明
<str> 字符串。
<count> 数字。
SELECT REPEAT('databend', 3);
┌──────────────────────────┐
│ REPEAT('databend', 3) │
├──────────────────────────┤
│ databenddatabenddatabend │
└──────────────────────────┘
SELECT REPEAT('databend', 0);
┌───────────────────────┐
│ REPEAT('databend', 0) │
├───────────────────────┤
│ │
└───────────────────────┘
SELECT REPEAT('databend', NULL);
┌──────────────────────────┐
│ REPEAT('databend', NULL) │
├──────────────────────────┤
│ NULL │
└──────────────────────────┘