Take a look at this and if you need an explanation, let me know and we'll break it down for you. select length (some_text) from (select replace (replace ( 'test' || CHR (13) || 'more text' || CHR (9) || 'even more text' || CHR (13) || 'more text' || CHR (9), CHR (13), RPAD (' ', 80)), CHR (9), RPAD (' ', 5)) some_text from DUAL);
On Mon, Sep 22, 2008 at 3:42 PM, Vlad <[EMAIL PROTECTED]> wrote: > > Thanks Michael ;-) > > To be honest I don't actually know 'how' the above function works, I > do know what it does though - it calculates the number of lines that a > text string will take up given a fixed column width. > > I know that this should normally be done by the presentation layer but > there are other reasons why doing it at the DB layer is actually > sensible. > > The things which make this more difficult than dividing the number of > characters by the line width are the following things:- > > - 10 carriage returns will actually take up 10 lines irrespective of > the column width, however they would only take up 10 characters > - Tab spaces take up 4-5 characters (simple solution is to replace all > characters in the string with 4-5 spaces) > > Any pointers would be gratefully received. > > Thanks > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---