oracle序列和并发

Whenever I do an insert into the oracle database, I perform an insert, there is a trigger set up on this table to increment the ID to emulate MYSQL's autoincrement.

Straight after the INSERT sql I perform the following SQL to retrieve the last ID of the last inserted row:

$stmt = $this->query("SELECT {$sequence}.CURRVAL FROM DUAL", PDO::FETCH_COLUMN);

I then use this ID to perform an UPDATE to modify columns in the row.

My question is this safe in terms of concurrency?

My understanding is that SEQUENCES are session safe? What exactly is a session in this case?

My question is this safe in terms of concurrency?

Generally speaking no, if your are using the trigger only to generate a sequence id (and supposing the logic of trigger is correct ) then its safe in terms of concurrency.

However, I recommandad you read this article page 18 it will explain when concurrency happens and how.

As for sequences , yes they are safe too . but as for the sessions I am not familiar with php.