Hey Guys!
Let's have some fun with strings today.
So, I've got some T-SQL code I'm translating into PL-SQL, and I've been encountering some uses of SQL Server's STUFF() function. Microsoft's documentation on the STUFF() function states:
The STUFF function inserts a string into another string. It deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position.
The header of the STUFF() function accepts the following arguments:
STUFF ( character_expression , start , length , replaceWith_expression )
So, considering the following code as our example, how can we manipulate a string in PL-SQL with as few calls to system functions as possible? Let's aim for the most performant solution - as always.
select stuff(
(
select '123456789'
from table_name for clob path('')
), 1, 4, ''
) as example
from dual;
And, GO!