Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-5602

Add support for a SQL REPEAT(string, count) function

    XMLWordPrintableJSON

Details

    • Normal

    Description

      A similar function was discussed with Rick Hillegas in this ticket:
      https://issues.apache.org/jira/browse/DERBY-5597

      Apparently, JDBC mentions a REPLACE function in its appendix:

      > Compare the JDBC escape function (from Appendix D2 of the 4.1 JDBC spec):
      > "REPLACE(string1, string2, string3) Replaces all occurrences of string2 in string1 with string3"

      It also mentions a REPEAT function

      "REPEAT(string, count) A character string formed by repeating string count times"

      This REPEAT function would be a nice-to-have enhancement to simulate padding directly in the database, where this may be needed. Most databases ship with some form of REPEAT:

      • RPAD(string, LENGTH(string) * count) in Oracle, Ingres
      • REPLICATE(string, count) in Sybase ASE, SQL Server
      • REPEAT(string, count) in DB2, H2, HSQLDB, MySQL, Postgres, Sybase SQL Anywhere

      Attachments

        Activity

          People

            Unassigned Unassigned
            lukas.eder Lukas Eder
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: