picoSQL - Language reference manual


5.3) String functions


In the following descriptions, we denote a string expression as string or string-1, string-2 etc.


ASCII(string)

Returns a numeric value corresponding to the ASCII value of the first character of string.


CHAR(num-expr)

Returns a string 1 character long whose ASCII value is equal to num-expr.


CONCAT(string-1, string-2)

Concatenates two strings into one large string.


CONVERT(num-expr,SQL_CHAR)

Returns a string containing the representation of num-expr.


CONVERT(string,SQL_DOUBLE)

Converts a string in a number. If the value contained in string cannot be interpreted as a number, then this function returns 0.


CURRENT_TIMESTAMP(format-string)

Returns a string containing a timestamp of the current date and time. The result string has a format as specified in format-string. The following characters has a special meaning in format-string:


Y year digit;

M month digit;

D day digit;

H hour digit;

N minute digit;

S second digit;

T millisecond digit (always 0).


All the other characters are transcripted literally. You can get the standard timestamp format with the following format-string:


'YYYY-MM-DD HH:NN:SS.TTT'


LCASE(string)
LOWER(string)

Converts all characters in string to lower case. LCASE and LOWER are synonyms.


LENGTH(string)

Returns the length of string.


LOCATE(string-1, string-2, num-expr)

Returns the character offset (base 1) into the string string-1 of the first occurrence of the string string-2, starting the search at the offset num-expr. If the string is not found, 0 is returned.


LTRIM(string)

Returns string with leading blanks removed.


RTRIM(string)

Returns string with trailing blanks removed.


SPACE( num-expr)

Returns a string num-expr blank characters long.


SUBSTRING(string, num-expr-1, num-expr-2)

Returns the substring of string starting at the given num-expr-1 start position (origin 1) and num-expr-2 characters long.


UCASE(string)
UPPER(string)

Converts all characters in string to upper case. UCASE and UPPER are synonyms.




Index Previous Next