Search notes:

Oracle SQL function: SUBSTR

substr has to mandatory and one optional parameter:
substr( text , position )
substr( text , position , length )

Two parameters

With two parameters, substr returns the portion of text from character position through the end of text.
select
   substr(
      '1234567890', -- Text
       5            -- Start position
   )
from
   dual;
--
-- 567890
Github repository Oracle-Patterns, path: /SQL/functions/text/substr/two-parameters.sql

Three parameters

The optional third parameter is used to limit the length of the returned string:
select
   substr(
      '1234567890', -- Text
       5          , -- Start position
       3            -- Length
   )
from
   dual;
--
-- 567
Github repository Oracle-Patterns, path: /SQL/functions/text/substr/three-parameters.sql

Test with CLOBS longer than 32K

create table tq84_substr_test (
   clb clob
);

begin
   insert into tq84_substr_test values ('');

   for c in ascii('a') .. ascii('z') loop
      update
         tq84_substr_test
      set
         clb = clb || lpad(chr(c), 4000, chr(c));
    end loop;
end;
/

select
   26*4000 - length(clb) -- 0
from
   tq84_substr_test;

select
   substr(clb, 25*4000, 2) -- yz
from
   tq84_substr_test;

drop   table tq84_substr_test;

Variants

substr comes in five variants:

See also

regexp_substr is the regular expression version of substr.
dbms_lob.substr
Functions related to text and strings
The SQL Server's function substring.

Index