答案 0 :(得分:1)
要仅获取INSERT INTO client (id, name, surname, surname2, dob, phone, email, address)
SELECT DISTINCT NVL(cl_dni, floor(dbms_random.value(10000000,100000000))),
cl_name, cl_surn1, cl_surn2, cl_birth, cl_phone, cl_email, cl_address
FROM purchases WHERE NOT EXISTS(SELECT id from client WHERE client.id = purchases.cl_dni);
和CSE
,请使用以下代码行:
EEE
该列表将仅包含两个元素,因为它还将被打印在logcat中:
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
ValueEventListener valueEventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
List<String> list = new ArrayList<>();
for(DataSnapshot ds : dataSnapshot.getChildren()) {
String key = ds.getKey();
list.add(key);
Log.d(TAG, key);
}
//Do what you need to do with your list
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Log.d(TAG, databaseError.getMessage()); //Don't ignore errors!
}
};
rootRef.addListenerForSingleValueEvent(valueEventListener);