vendredi 2 octobre 2015

Android SQLite - Insert Trigger, with multiple insert statements, get ID for second statement

I have the following insert trigger

CREATE TRIGGER View_Insert_Trigger 
INSTEAD OF INSERT ON View_A_B
BEGIN 
    INSERT INTO TABLE_A
    (foreign_key_A,foreign_key_B,position)
    VALUES
    (NEW.foreign_key_A,NEW.foreign_key_B,NEW.position);
    INSERT INTO Table_B
    (table_A_foreign_key,data_A,data_B,data_C,data_D)
    VALUES
    (**What do I put here? - Need ID from insert statement above**,NEW.data_A,NEW.data_B,NEW.data_C,NEW.data_D);
END

How can I get the ID from the first insert statement so I can use it in the second insert statement?

Aucun commentaire:

Enregistrer un commentaire