Can anyone help me on this?

can anyone help me to write a query which prints the following
_a
__h
___o
_____o
____o
___o
__h
_a
y
thanx

Looks like ASCII-art, eh?
Anyway, check the following:
SQL> column p format a30
SQL>
SQL> var yahoo varchar2(100)
SQL> exec :yahoo := 'yahoo';
PL/SQL procedure successfully completed.
SQL> with perversion as
  2  ( select rownum rn,
  3           length(:yahoo) cnt,
  4           rpad('_', level - 1, '_') || substr(:yahoo, rownum, 1) p
  5      from dual
  6   connect by level <= length(:yahoo))
  7  select p
  8    from (select rn, p
  9            from perversion
10           union all
11          select 2*cnt - rn + 1, p
12            from perversion
13           order by 1);
P
y
_a
__h
___o
____o
____o
___o
__h
_a
y
10 rows selected.
SQL> exec :yahoo := 'Hyderabad'
PL/SQL procedure successfully completed.
SQL> with perversion as
  2  ( select rownum rn,
  3           length(:yahoo) cnt,
  4           rpad('_', level - 1, '_') || substr(:yahoo, rownum, 1) p
  5      from dual
  6   connect by level <= length(:yahoo))
  7  select p
  8    from (select rn, p
  9            from perversion
10           union all
11          select 2*cnt - rn + 1, p
12            from perversion
13           order by 1);
P
H
_y
__d
___e
____r
_____a
______b
_______a
________d
________d
_______a
______b
_____a
____r
___e
__d
_y
H
18 rows selected.Hope this helps.

Similar Messages

Maybe you are looking for