Mega Code Archive

 
Categories / PostgreSQL / String Functions
 

Using char_length( string )

postgres=# postgres=# CREATE TABLE test1 (a character(4)); CREATE TABLE postgres=# postgres=# INSERT INTO test1 VALUES ('ok'); INSERT 0 1 postgres=# SELECT a, char_length(a) FROM test1;   a   | char_length ------+-------------  ok   |           2 (1 row) postgres=# postgres=# drop table test1; DROP TABLE postgres=# postgres=#