laravel-oci8
laravel-oci8 copied to clipboard
Insert: Getting the Sequence Number
I am using Laravel 7.x query builder to perform an insert statement, however, the Oracle database trigger automatically creates a sequence number. I want to do two things:
- get the sequence number that the database created.
- pass that sequence number via Ajax so I can perform a refresh.
public function store(Request $request)
{
if ($request->ajax()) {
$insert = DB::table('test_table')->insert([
'column1'=>$column1,
'column2'=>$colum2
]);
return response()->json(array('message'=> $insert), 200); } }
- Centos 7
- PHP Version: 7.3.16
- Laravel Version: 7.x
- Laravel-OCI8 Version: 7
Just fetch the next sequence value. See https://yajrabox.com/docs/laravel-oci8/master/sequence for ref.
Just found out while working on #615 that there is a failing test for this scenario. Will try to fix on future release. Thanks!