How to emulate REPEAT() in SQLite

前端 未结 4 2022
情话喂你
情话喂你 2020-12-17 22:09

Most relational databases have some sort of REPEAT() string function, for instance:

SELECT REPEAT(\'abc\', 3)

Would yield

4条回答
  •  -上瘾入骨i
    2020-12-17 22:42

    A simplified version of @Lukas Eder's solution using hex() instead of quote:

    -- X = string
    -- Y = number of repetitions
    
    replace(hex(zeroblob(Y)), '00', X) 
    

提交回复
热议问题