The REPEAT function returns a new value that repeats a given value a given number of times. The general syntax of the function is:
- REPEAT (string, count)
Code: Select all
dbadmin=> SELECT REPEAT('Vertica is cool! ', 3) "The Truth",
dbadmin-> 'Five' || REPEAT('.', 5) || 'Dots' "Dippin' Dots";
The Truth | Dippin' Dots
-----------------------------------------------------+---------------
Vertica is cool! Vertica is cool! Vertica is cool! | Five.....Dots
(1 row)
Code: Select all
dbadmin=> SELECT REPEAT('Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... ', 10) "Annoying Joke";
Annoying Joke
------------------------------------------------------------------------------------------------------------------------
Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat... Pete and Repeat were in a boat. Pete fell off. Who was left? Repeat...
(1 row)
Code: Select all
dbadmin=> SELECT LENGTH(REPEAT('A', 65000)) "65,000",
dbadmin-> LENGTH(REPEAT('A', 65001)) "Still 65,000";
65,000 | Still 65,000
--------+--------------
65000 | 65000
(1 row)