i was wondering if there was a function in Oracle to count the number of character size in Oracle, i.e. given "Burger", the SQL returns 6.
i.e. select XXX('Burger') from DUAL;
The Oracle REGEXP_COUNT function is used to count the number of times that a pattern occurs in a string. It returns an integer indicating the number of occurrences of a pattern. If no match is found, then the function returns 0.
SQL Server LEN() FunctionThe LEN() function returns the length of a string. Note: Trailing spaces at the end of the string is not included when calculating the length. However, leading spaces at the start of the string is included when calculating the length. Tip: Also look at the DATALENGTH() function.
The PLSQL LENGTH function is used for returning the length of the specified string, in other words, it returns the length of char. The char accepted by the LENGTH function in PLSQL can be of any of the datatypes such as CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.
You can use LENGTH() for CHAR / VARCHAR2 and DBMS_LOB.GETLENGTH() for CLOB. Both functions will count actual characters (not bytes).
See the linked documentation if you do need bytes.
you need length() function
select length(customer_name) from ar.ra_customers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With