sql - Query to get number of % sign = length of string in the next row in Oracle 10g -
is there sql query in oracle10g can give desired output given required in below sample. query should print name first , in second row should print "%" equal in number length of string.
could please help?
below sample of table column
jim john michael
and output should come below :
jim %%% john %%%% michael %%%%%%%
this considered issue presentation logic, not database logic. however, 1 option use union all
, , length
, rpad
correct number of %
signs. you'd need establish row number keep order together.
here's 1 approach:
select name ( select name, rownum rn yourtable union select rpad('%', length(name), '%') name, rownum + 1 rn yourtable ) t order rn, name
Comments
Post a Comment