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 8405919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:57:23+00:00 2026-06-09T22:57:23+00:00

I tried to do a query to the android sqlite database with the following

  • 0

I tried to do a query to the android sqlite database with the following select, but it shows only error when I put it in eclipse.

stmt = "SELECT * FROM user_zones JOIN pos WHERE user_zones.zone_id = (
                CASE  
                 WHEN user_zones.type_zone_id = 'Zone' THEN pos.zone_id
                 WHEN user_zones.type_zone_id = 'Area' THEN pos.area_id
                 WHEN user_zones.type_zone_id = 'Town' THEN pos.town_id
                 WHEN user_zones.type_zone_id = 'MicroZone' THEN pos.microzone_id END) AND user_zones.user_id = '"+id_user+"'";

Has anyone any idea about what is wrong in the above syntax? Thank you

EDIT: I cannot even run the code, there are syntax errors!

Errors:cannot find symbol class CASE

unclosed character literal
cannot find symbol class 'THEN'

expected ';' ....and so on
  • 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-09T22:57:25+00:00Added an answer on June 9, 2026 at 10:57 pm

    If that is literally what you have pasted into your Java source, then your problem is that string literals in Java can’t span multiple lines. You have to split it up using a separate string literal for each line, and glue them all together with the + operator. Like this.

    stmt = "SELECT * FROM user_zones JOIN pos WHERE user_zones.zone_id = (" +
           "        CASE" +
           ...
    

    See Paste a multi-line Java String in Eclipse

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

Sidebar

Related Questions

I tried running the following query to restore a database: restore database myDatabase from
I tried with this query but no luck : SELECT tr.transferfrom, tr.transferto, br.id as
I'm trying to store dollar amounts in the sqlite database provided by android but
When I get a Cursor back from a sqlite DB query in Android it
I'm facing this problem 08-23 14:54:25.370: ERROR/AndroidRuntime(16728): Caused by: android.database.sqlite.SQLiteException: near table: syntax error:
Following the Android sample for populating a ListView , I query an array from
Having tried this query a million different ways, I can't seem to SELECT 'count_lonely_vehicles'
I need query to get data between two days.I tried with this.But it gives
I tried to split a string in a linq query. I got an error
Im trying to get an object form my SQLite database in my Android application.

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.