My table looks like the following:

```
id | value1 | count

```

I have a list of `value1` in RAM and I want to do the following: 

```
    (if value1 exists in table){
    count + 1}else{
    insert new row into table}

```

Is this possible with Oracle or do I have to take it to the code, do a `for loop` and execute one element of the list at a time? The list contains 5 million values. I'd have to do something like this in the code:

```
for(int i=0; i<list.size; i++){
  boolean exists = checkifexists(list.get(i));
  if(exists=true){
    countPlusOne(list.get(i);
  }else{
    createNewRow(list.get(i));
  }
}

```

So I have to do at least two queries for each value, totalling 10m+ queries. This could take a long time and may not be the most efficient way to do this. I'm trying to think of another way.