Open Sudheert7 opened 4 weeks ago
Fixed by editing Line 125 in file laravel-oci8/src/Oci8/Schema/Sequence.php
Fix:
public function nextValue($name)
{
if (! $name) {
return 0;
}
$name = $this->wrap($name);
return $this->connection->selectOne("SELECT '$name.NEXTVAL' as \"id\" FROM DUAL")->id;
}
and edited line 370 in file laravel-pdo-via-oci8/src/Pdo/Oci8.php
public function lastInsertId(string $name = null): false|string
{
if (! isset($this->table)) {
return 0;
}
if (is_null($name)) {
$name = $this->table.'_id_seq';
}
if (! $this->checkSequence($name)) {
return 0;
}
$stmt = $this->query("SELECT '$name.CURRVAL' FROM DUAL", PDO::FETCH_COLUMN);
return $stmt->fetch();
}
Thanks for reporting, please feel free to submit a PR to fix it.
Can you provide the model which has 1
as the sequence name? Did you override the $sequence
property by any chance?
Summary of problem
System details Operating System: Ubuntu PHP Version: 8.3 Laravel Version: 10.0 PHP OCI 8-3.4.0 Laravel-OCI8 Version: 10.6 Oracle DB Version : 19
Example:
ProductModel product_id product_code product_name product_detail
Creating of new product is working, saving in oracle DB
OderModel product_id order_code
Select drop down to select prod ID Belongs to relation with Form1 belongs to Product::class, prod_id
When creating order , exception from eloquent.
Error Code : 923 Error Message : ORA-00923: FROM keyword not found where expected Position : 17 Statement : SELECT 1.NEXTVAL as "id" FROM DUAL Bindings : []
Code snippet of problem
laravel-debugbar:
Tried to Debug - Run query in SQL Developer(IDE)
Actual Query as in Application
Error: ORA-00923: FROM keyword not found where expected
Working Query
Result: 1.NEXTVAL