سؤال

I have an SQL command: select CONCAT(REPLICATE('*', rank), sname, REPLICATE('*', rank)) from soldiers;

But it doesn't works, because only mssql supports replicate. How is it possible to manage it in oracle sql?

هل كانت مفيدة؟

المحلول

RPAD should work

select RPAD('*', rank, '*') from soldiers;

But this kind of formatting is also easily done client-side (if you have an application between you and the database and are not just using an SQL prompt directly).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top