MySQL Tutorial

PostgreSQL OCTET_LENGTH() function

OCTET_LENGTH() function

The PostgreSQL octet_length function is used to count the number of bytes in a specified string.




Name Description
string A string whose length is to be returned.

The above function is a synonym for LENGTH().

PostgreSQL Version: 9.3

Pictorial Presentation of PostgreSQL OCTET_LENGTH() function

Pictorical presentation of PostgreSQL OCTET_LENGTH function

Example: PostgreSQL OCTET_LENGTH() function

The following PostgreSQL statement will return the length of the string w3resource. The return value is 10.



SELECT octet_length('w3resource') AS "octet_length";

Sample Output:

(1 row)

Many of our valued users post comments along with piece of code. Disqus may, false positively, consider those piece of code as Bad or Starnge syntax and send those comments to spam automatically. Even if that happens, we will make sure those useful comments are taken out of spam and approved. It may take a couple of days for that though, but any useful comment will be brought to public view for sure. We regret if that happend to any user. You may write us directly regarding this to - w3resource[at]yahoo[dot]com.