DDC-3089: Doctrine1 to Doctrine2 Oracle type float #3836

Closed
opened 2026-01-22 14:28:52 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 17, 2014).

Originally assigned to: @deeky666 on GitHub.

Jira issue originally created by user servietsky777:

I have a big problem migrating an application from Doctrine1 to Doctrine2.

The variable ROUNDNUMBER was set with Doctrine1 in the Oracle 10G database with the following schema :
ApprenticeYeartype:
columns:
id: {type: integer, notnull: true, primary: true, autoincrement: true}
name: {type: string(255), notnull: true}
roundNumber: {type: float, notnull: true}

The values stored in this variable are: 0.1 or 0.5 or 1.0

In Oracle, the data type was set as "NUMBER" with no precision or scale set. I found this "If
a precision is not specified, the column stores values as given. If no scale is
specified, the scale is zero. ".
So there should be no scale which is weird because it worked with the values 0.1, 0.5...
It worked nicely on Symfony1 and Doctrine1, but for the migration to Symfony2 and Doctrine2, I used the command to import the schema from the database "php app/console doctrine:mapping:convert"

The created schema's ROUNDNUMBER variable was set with the Doctrine2 type "Integer". So now I get the variable as an int and not float and so I can't use it.

I tried changing the type to decimal, float etc...
/****

  • @var integer
    *
  • @ORM\Column(name="ROUNDNUMBER", type="integer", nullable=false)
    */
    private $roundnumber;

But I keep getting this error :
[Doctrine\DBAL\DBALException]
An exception occurred while executing 'ALTER TABLE APPRENTICE_YEARTYPE MODI
FY (ROUNDNUMBER DOUBLE PRECISION DEFAULT NULL)':

ORA-01440: column to be modified must be empty to decrease precision or sca
le

If anyone know a solution, please help me !

Originally created by @doctrinebot on GitHub (Apr 17, 2014). Originally assigned to: @deeky666 on GitHub. Jira issue originally created by user servietsky777: I have a big problem migrating an application from Doctrine1 to Doctrine2. The variable ROUNDNUMBER was set with Doctrine1 in the Oracle 10G database with the following schema : ApprenticeYeartype: columns: id: {type: integer, notnull: true, primary: true, autoincrement: true} name: {type: string(255), notnull: true} roundNumber: {type: float, notnull: true} The values stored in this variable are: 0.1 or 0.5 or 1.0 In Oracle, the data type was set as "NUMBER" with no precision or scale set. I found this "If a precision is not specified, the column stores values as given. If no scale is specified, the scale is zero. ". So there should be no scale which is weird because it worked with the values 0.1, 0.5... It worked nicely on Symfony1 and Doctrine1, but for the migration to Symfony2 and Doctrine2, I used the command to import the schema from the database "php app/console doctrine:mapping:convert" The created schema's ROUNDNUMBER variable was set with the Doctrine2 type "Integer". So now I get the variable as an int and not float and so I can't use it. I tried changing the type to decimal, float etc... /**** - @var integer * - @ORM\Column(name="ROUNDNUMBER", type="integer", nullable=false) */ private $roundnumber; But I keep getting this error : [Doctrine\DBAL\DBALException] An exception occurred while executing 'ALTER TABLE APPRENTICE_YEARTYPE MODI FY (ROUNDNUMBER DOUBLE PRECISION DEFAULT NULL)': ORA-01440: column to be modified must be empty to decrease precision or sca le If anyone know a solution, please help me !
admin added the Bug label 2026-01-22 14:28:52 +01:00
admin closed this issue 2026-01-22 14:28:53 +01:00
Author
Owner

@doctrinebot commented on GitHub (Apr 17, 2014):

Comment created by @deeky666:

Looks like you create the column ROUNDNUMBER with an integer type mapping. Use "float" or "decimal" instead. When updating the schema please ensure that your ROUNDNUMBER column contains no data or at least all values in the column have to be NULL. See http://www.techonthenet.com/oracle/errors/ora01440.php
Please note that Doctrine's "float" maps to "DOUBLE PRECISION" and "decimal" to "NUMERIC(p,s)" on Oracle. See the DBAL types documentation for further information: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#mapping-matrix

If you need further help, just drop me a line.

@doctrinebot commented on GitHub (Apr 17, 2014): Comment created by @deeky666: Looks like you create the column ROUNDNUMBER with an integer type mapping. Use "float" or "decimal" instead. When updating the schema please ensure that your ROUNDNUMBER column contains no data or at least all values in the column have to be NULL. See http://www.techonthenet.com/oracle/errors/ora01440.php Please note that Doctrine's "float" maps to "DOUBLE PRECISION" and "decimal" to "NUMERIC(p,s)" on Oracle. See the DBAL types documentation for further information: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#mapping-matrix If you need further help, just drop me a line.
Author
Owner

@doctrinebot commented on GitHub (Apr 17, 2014):

Comment created by @deeky666:

Not a Doctrine bug.

@doctrinebot commented on GitHub (Apr 17, 2014): Comment created by @deeky666: Not a Doctrine bug.
Author
Owner

@doctrinebot commented on GitHub (Apr 17, 2014):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Apr 17, 2014): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3836