Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    2,296

    Unanswered: Formatting one-line sql-statements

    Does anyone know of an easy way (or application) to format long one-line sql string statements with carriage returns and such?

    I am so tired of hitting returns to format this stuff.

    Ie: Such as you get a 500 one-line statement from sql_text and you want it formatted so you can view it easily.

    from:
    select col1, col2, col3 from t1, t2, t3 where t1.a = t2.a and t2.a = t3.a;

    to anything like the below:

    PHP Code:
    select 
      col1

      
    col2
      
    col3 
    from 
      t1

      
    t2
      
    t3 
    where 
      t1
    .t2.and 
      
    t2.t3.a
    Last edited by The_Duck; 07-31-03 at 10:39.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  2. #2
    Join Date
    Nov 2002
    Location
    Desk, slightly south of keyboard
    Posts
    697
    Hi,

    I guess this is SQL you're getting from v$sqltext? If so try getting it from v$sqltext_with_newlines.

    Hth
    Bill

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296
    Bill, yes.

    I also heard a rumor that TOAD can somehow format it. I'll have to look into how that works.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  4. #4
    Join Date
    Nov 2002
    Location
    Desk, slightly south of keyboard
    Posts
    697
    Yes, some versions have SqlFormatter with it. It may be one of the options they enable as a demo hoping you'll buy it or it comes with TOAD by default - I'm not sure.

    Cheers
    Bill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •