My previous solution had a flaw. When input string is ALL ****, it
will give NULL.
This new solution corrects that problem.
SELECT NVL (
          SUBSTR (
             RPAD ('x', LENGTH (address) + 1 - LENGTH (REPLACE
(address, '*', '')), '*'),
             2),
          address)
          rslt
  FROM yourtable;

On Tue, Jan 10, 2012 at 10:24 AM, Michael Moore <[email protected]> wrote:
> SELECT SUBSTR (
>           RPAD ('x', LENGTH (address) + 1 - LENGTH (REPLACE (address,
> '*', '')), '*'),
>           2)
>           rslt
>   FROM yourtable;
>
> This will work. You should avoid using regular expressions for
> performance reasons when processing large amounts of data.
>
> Mike
>
>
> On Tue, Jan 10, 2012 at 7:59 AM, mallikarjuna D <[email protected]> 
> wrote:
>>
>> WHERE INSTR(Address,'*')>0
>>
>>
>> On 1/7/12, SANDEEP REDDY <[email protected]> wrote:
>> > I have a table like this
>> >
>> >
>> > S.no        Name      Address
>> > -------       ----------     ---------------
>> >
>> > 1           a              7a, chennai
>> > 2           b               madras,chennai**
>> > 3           c               *****chengal
>> > 4          d                  *****
>> > 5           e                     ***
>> > 6          f                       *
>> >
>> >
>> > HI, i need to get output that contains only *'s ( only * but no
>> > alphanumeric & special characters)
>> >
>> > I didn't get any idea.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Oracle PL/SQL" group.
>> > To post to this group, send email to [email protected]
>> > To unsubscribe from this group, send email to
>> > [email protected]
>> > For more options, visit this group at
>> > http://groups.google.com/group/Oracle-PLSQL?hl=en
>> >
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Oracle PL/SQL" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/Oracle-PLSQL?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

Reply via email to