yajra / laravel-oci8

Oracle DB driver for Laravel via OCI8

Home Page:https://yajrabox.com/docs/laravel-oci8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error Code : 904 Error Message : ORA-00904: "COMMENT"

jsamaniegog opened this issue · comments

Summary of problem or feature request

When saving I get this error: Error Code : 904 Error Message : ORA-00904: "COMMENT"

Code snippet of problem

$model = Model::factory()->make();
$model->comment = 'Test';
$model->save();

System details

  • Windows 10
  • PHP 8.1
  • Laravel 10
  • Laravel-OCI8 10.3

Does the comment column exist? If yes, is it created via Laravel migration?

Another possible cause is the comment column is stored as "comment" and it should be "COMMENT".

You're right, the field name was in lowercase. It seems that I changed it in the migration to $table->string('"comment"') (with quotes) because I was getting the error "Error Message : ORA-00904: "comment": ", but this is because I use the comment method, If I remove it, it works fine and creates the field in uppercase (bug?).

Migration code that fails:

       Schema::table('my_table', function (Blueprint $table) {
            $table->string('comment')
                ->nullable()
                ->after('other_field')
                ->comment('The comment.');
        });

Thank you very much!

Not a bug but expected behavior. I think comment is a reserved word in Oracle and the solution for this limitation is to make all the fields in uppercase. By default, all fields created via Laravel migration will be converted to uppercase. If you want it to be case sensitive, you enclose the field name with a double quote but this is not advisable since it causes a lot of issues when working with eloquent and query builder.

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 7 days since being marked as stale.