Monday 8 October 2012

counting no of characters in a given string in Oracle

We can find no of characters in a string  based on this query in two different ways:
=======================================================

select NVL(LENGTH(REGEXP_REPLACE(ENAME, '[^A]')),0) REG_COUNT,
       length(ename) - length(replace(ename, 'A')) COUNT,
       ENAME,
       SAL,
       JOB,
       DEPTNO
  FROM SCOTT.EMP;


No comments:

Post a Comment