I am new to android. I haven't worked with SQLite DBs before.
I think this is a very basic question, but I am unable to find the solution.
The code is here (assume declarations)
public void onCreate(SQLiteDatabase db) {
String CREATE_CATEGORIES_TABLE = "CREATE TABLE " + FORMULA + "("
+ CAT_CD + " TEXT ," + S_CAT_CD + " TEXT, PRIMARY
KEY(CAT_CD,S_CAT_CD))";
db.execSQL(CREATE_CATEGORIES_TABLE);
String CREATE_CAT_DESC_TABLE="CREATE TABLE "+ FORMULA_CAT_DESC + "
("+CAT_CD+" TEXT PRIMARY KEY, "+ DESC +" TEXT ) ";
db.execSQL(CREATE_CAT_DESC_TABLE);
String CREATE_CURRENCY_TABLE="CREATE TABLE "+ VI_CURRENCY + "("+
CURRENCY_CD +" TEXT PRIMARY KEY, "+ CURRENCY_SIGN +" TEXT ) ";
db.execSQL(CREATE_CURRENCY_TABLE);
String query= "INSERT INTO "+ VI_CURRENCY +" ("+CURRENCY_CD +",
"+CURRENCY_SIGN+ ") VALUES " +
"('INR', '₹'), " +
" ('USD','$') " +
"('JPY','¥') ";
db.execSQL(query);
}
The first three commands execute successfully, while by executing the insert command, SQLite throws an exeption.