2 Replies Latest reply: Feb 4, 2013 1:24 AM by UW (Germany) RSS

    Interpretation of \n as "new line"

    UW (Germany)
      With SQL-Developer version 3.2.09 I get the following result, when I run this query as an SQL script:
      select 'A \n B' as t from dual;
      
      T    
      ------
      A
      B
      I have an other computer with an older version of SQL-Developer and there the result is:
      T      
      ------ 
      A \n B 
      The second result I get with SQL-Plus or with SQL-Developer, when I run this query as a single statment and not as a script. Is this behaviour a bug or a feature of the new version of SQL-Developer? Is it possible to switch off this interpretation of \n as "new line" in the script result window of SQL-Developer?

      Edited by: UW (Germany) on 04.02.2013 08:14, typo removed
        • 1. Re: Interpretation of \n as "new line"
          Gary Graham-Oracle
          Hi UW,

          The behavior changed between the 3.0 patch 1 and the 3.1 release, and no preference exists to control it. There is no guarantee that SQL Developer's worksheet mimics SQL*Plus behavior exactly, but that is the general direction we are headed.

          Not sure if it was intentional but, based on expected escaping behavior, one would think that if
          select 'A \n B' as t from dual;
          respects the logical newline in Run Script, then
          select 'A \ \n B' as t from dual; --ignore the extra space between the backslashes
          would do what you wish, but it does not. In any event, SQL*Plus does no escaping in this context.

          I will log a bug if this turns out to be a regression.

          The following thread is not directly related to this issue. It only illustrates that Run Statement and Run Script behavior differ with respect to how embedded physical newline characters are displayed:
          Re: SQL Developer autoformating text values with hypen (-)

          Especially see Barry's comment on compression at the end.

          Regards,
          Gary
          SQL Developer Team
          • 2. Re: Interpretation of \n as "new line"
            UW (Germany)
            Thank you for the reply. My main intention was to know, that it is not my fault when the two versions of SQL developer behave different. But I think, that there should be a way to get \n as output in an SQL script, either with escaping or with a switch in the preferences of SQL developer. Also chr(92)||chr(110) does not help in this case.