select c.cpf_cnpj, case when length(c.cpf_cnpj) > 11 then 2 else 1 end case from (
select c.cpf_cnpj,
case
when length(c.cpf_cnpj) > 11 then
2
else
1
end case
from (
select '12345655551' cpf_cnpj
from dual
union
select '01234567000115' cpf_cnpj
from dual) c