Rakesh
Rakesh

Reputation: 1434

Oracle, Pl/SQL: substitution/replace function

I am facing a unique challenge, the problem I'm facing is something like this:

I need to ignore the zero from the input: For example

Example 1
Input --> 1580
output --> 158

Example 2
Input --> 3008
output --> 38

Is there any built function or through normal query I can solve the above problem or do I need to write custom pl/sql code.

Please suggest.

Upvotes: 0

Views: 141

Answers (1)

Andrew Paes
Andrew Paes

Reputation: 2022

SQL:

select 3008 original, REPLACE(TO_CHAR(3008), '0', '') replaced from dual;

Result:

original | replaced
---------|----------
3008     | 38
---------|----------

Upvotes: 1

Related Questions