Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8240193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:24:16+00:00 2026-06-07T20:24:16+00:00

I have a very long SQL statement inside of a Java String. In eclipse,

  • 0

I have a very long SQL statement inside of a Java String. In eclipse, how can I easily get the SQL statement’s text without the Java String syntax? I’ve been manually removing it, but in IntelliJ Idea, it’s possible for one to get the text without having to do any manual formatting work to remove the Java String syntax (such as " and + characters). Does Eclipse have a similar feature?

As an added bonus, I would ask if it were also possible to get the string with the newlines put in place as it was formatted in the IDE, even if no \n characters were present in the string itself.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:24:17+00:00Added an answer on June 7, 2026 at 8:24 pm

    Depending on your SQL client, it could have this feature.
    I know that TOAD has this feature built-in. I also remember Squirrel having it.

    So when pasted into the SQL editor of TOAD, the code is automatically extracted from the Java string syntax. I remember that it also worked with constructs like StringBuffer/StringBuilder.

    See: http://dev.toadformysql.com/webhelp/Content/Editor/Convert_SQL_Embedded_SQL.htm

    Or you can create a simple regexp working for your sample code, for example this jsfiddle.
    It works with a regex for sql like:

    "select something \r\n" +
    "  from dual " +
     "where 1 = 1\r\n"; 
    

    The jsfiddle should output

    select something
      from dual
     where 1=1
    

    Still it is not beautifully formatted (even if with the <pre> tag it should preserve spaces), but your SQL IDE should help you with that, no?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very long String and I want to read character by character
I have a very long text and I need to hide everything except the
I have a very long string which includes many new lines ( it's a
after a very long sql query a have a result that is in this
I have a SQL query that takes a very long time to run on
I have a very long T-sql script, it is a single batch, something like
I have very long integer sequences that look like this (arbitrary length!): 0000000001110002220033333 Now
I have a very long javascript (so long that it's too long to escape
We have a very long form that has a number of fields and 2
I have a very long table in my webpage. When I print it, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.