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

  • Home
  • SEARCH
  • 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 8606299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:03:29+00:00 2026-06-12T03:03:29+00:00

This is my table-creation-command: private static final String PINGPONG_CREATE = create table + TABLE_PINGPONG

  • 0

This is my table-creation-command:

private static final String PINGPONG_CREATE = "create table " + TABLE_PINGPONG + "(" + COLUMN_ID_PINGPONG + " integer primary key autoincrement, " + COLUMN_CNAME +
            " text not null, " + COLUMN_DATE + " text not null, " + " text not null, " + COLUMN_LEAD + " numeric, " + COLUMN_PLACE + " text not null, " 
            + COLUMN_SET_ONE1 + " numeric, " + COLUMN_SET_ONE2 + " numeric, " + COLUMN_SET_TWO1 + " numeric, " + COLUMN_SET_TWO2 + " numeric, " + COLUMN_SET_THREE1
             + " numeric, " + COLUMN_SET_THREE2 + " numeric, " + COLUMN_SET_FOUR1 + " numeric, " + COLUMN_SET_FOUR2 + " numeric, " + COLUMN_SET_FIVE1  + " numeric, " 
            + COLUMN_SET_FIVE2 + " numeric, " + COLUMN_SET_SIX1 + " numeric, " + COLUMN_SET_SIX2 + " numeric, " + COLUMN_SET_SEVEN1 + " numeric, " + COLUMN_SET_SEVEN2
             + " numeric, " + COLUMN_RESULT1 + " numeric, " + COLUMN_RESULT2 + " numeric);"; 

this is my method to enter a “PingPongeEntry” into the database

public void createPingPongEntry(int lead, String challengeName, String date, String place, int set11, int set12, int set21, int set22,
            int set31, int set32, int set41, int set42, int set51, int set52, int set61, int set62, int set71, int set72, int tot1, int tot2){
        ContentValues values = new ContentValues();
        values.put(CustomSQLiteHelper.COLUMN_LEAD, lead);
        values.put(CustomSQLiteHelper.COLUMN_CNAME, challengeName);
        values.put(CustomSQLiteHelper.COLUMN_DATE, date);
        values.put(CustomSQLiteHelper.COLUMN_PLACE, place);
        values.put(CustomSQLiteHelper.COLUMN_SET_ONE1, set11);
        values.put(CustomSQLiteHelper.COLUMN_SET_ONE2, set12);
        values.put(CustomSQLiteHelper.COLUMN_SET_TWO1, set21);
        values.put(CustomSQLiteHelper.COLUMN_SET_TWO2, set22);
        values.put(CustomSQLiteHelper.COLUMN_SET_THREE1, set31);
        values.put(CustomSQLiteHelper.COLUMN_SET_THREE2, set32);
        values.put(CustomSQLiteHelper.COLUMN_SET_FOUR1, set41);
        values.put(CustomSQLiteHelper.COLUMN_SET_FOUR2, set42);
        values.put(CustomSQLiteHelper.COLUMN_SET_FIVE1, set51);
        values.put(CustomSQLiteHelper.COLUMN_SET_FIVE2, set52);
        values.put(CustomSQLiteHelper.COLUMN_SET_SIX1, set61);
        values.put(CustomSQLiteHelper.COLUMN_SET_SIX2, set62);
        values.put(CustomSQLiteHelper.COLUMN_SET_SEVEN1, set71);
        values.put(CustomSQLiteHelper.COLUMN_SET_SEVEN2, set72);
        values.put(CustomSQLiteHelper.COLUMN_RESULT1, tot1);
        values.put(CustomSQLiteHelper.COLUMN_RESULT2, tot2);

        long insertID = database.insert(CustomSQLiteHelper.TABLE_PINGPONG, null, values);

        Cursor cursor = database.query(CustomSQLiteHelper.TABLE_PINGPONG, allColumns3, CustomSQLiteHelper.COLUMN_ID_RUNNING + " = " + insertID, null, null, null, null);
        cursor.moveToFirst();
        cursor.close();
    }

That’s the allColums3-String[]

private String[] allColumns3 = {CustomSQLiteHelper.COLUMN_ID_PINGPONG, CustomSQLiteHelper.COLUMN_CNAME, CustomSQLiteHelper.COLUMN_DATE, CustomSQLiteHelper.COLUMN_PLACE, CustomSQLiteHelper.COLUMN_LEAD,
                                    CustomSQLiteHelper.COLUMN_SET_ONE1,
                                    CustomSQLiteHelper.COLUMN_SET_ONE2, CustomSQLiteHelper.COLUMN_SET_TWO1, CustomSQLiteHelper.COLUMN_SET_TWO2, CustomSQLiteHelper.COLUMN_SET_THREE1, CustomSQLiteHelper.COLUMN_SET_THREE2,
                                    CustomSQLiteHelper.COLUMN_SET_FOUR1, CustomSQLiteHelper.COLUMN_SET_FOUR2, CustomSQLiteHelper.COLUMN_SET_FIVE1, CustomSQLiteHelper.COLUMN_SET_FIVE2, CustomSQLiteHelper.COLUMN_SET_SIX1,
                                    CustomSQLiteHelper.COLUMN_SET_SIX2, CustomSQLiteHelper.COLUMN_SET_SEVEN1, CustomSQLiteHelper.COLUMN_SET_SEVEN2, CustomSQLiteHelper.COLUMN_RESULT1, CustomSQLiteHelper.COLUMN_RESULT2};

Now at line long insertID = database.insert(CustomSQLiteHelper.TABLE_PINGPONG, null, values); I’m getting the SQLiteConstraintException, and I don’t know why. It says:

09-29 19:55:13.151: E/Database(1609): Error inserting set51=0 set52=0 set41=3 set61=0 lead=0 set72=0 set71=0 set62=0 date=29-09-2012 result1=4 result2=0 name=pingpong set32=1 set31=3 set42=1 place=hier set22=1 set21=3 set12=1 set11=3

(I’m also confused here why there is no order of the inserting values)

I’ve read a few questions about this topic here, but all recommandation given there are followed: the primary key is autoincremented, and plus at this point, where I’m trying to insert the record, the database is empty.

I have 2 methods to insert FootBallEntrys and Games by analogy to this, and everything works fine. So why it doesn’t create a unique uid here?

  • 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-12T03:03:30+00:00Added an answer on June 12, 2026 at 3:03 am

    If you get a ConstraintException, you are violating some constraint in the table.
    The only rule you have is “Primary key” which creates backstage a “Unique” constraint.
    Make sure you are not trying to insert an already existing value in the column “COLUMN_ID_PINGPONG”.

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

Sidebar

Related Questions

I'm creating the table with this command: CREATE TABLE Comp ( SerialNumber Number Primary
This is my table creation in the oncreate method of my Dbadatper String CREATE_EXERCISES_TABLE
Hi all I can't find the error in this table creation bit, seems really
this table i want to create job_id dynamic Jobs Title text Job Description text
This table is used to store sessions (events): CREATE TABLE session ( id int(11)
With this table: CREATE TABLE test_insert ( col1 INT, col2 VARCHAR(10), col3 DATE )
An invalid datatype is returned when I issue following command: CREATE TABLE msg_info (
Using table creation as normal: t = Table(name, meta, [columns ...]) This is the
Can you guys see anything wrong with a db table creation statement? CREATE TABLE
This is a schema of a MySQL table creation. What is the meaning of

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.