SUBSTR returns a portion of char, beginning at character @StartPos, @Length characters long.
If @StartPos is 0, it is treated as 1.
If @StartPos is positive, Oracle counts from the beginning of char to find the first character.
If @StartPos is negative, Oracle counts backwards from the end of char.
A short but interesting article, the author has figured out a way to create a PDF from a stored procedure without using a third party library.