Page 1 of 1

ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Sat 10 Dec 2016 13:36
by cointec
Unidac 6.4.16
Delphi 2007
Oracle direct mode
Oracle 12c

Hello, I'm having problems updating some rows in a table with a CLOB field. I get the error in the subject, but I can update other rows with other text content.

This is the table ddl

Code: Select all

CREATE TABLE UNIDAC_TEST.PET_PRUEBA (
    IDPETICIONPRUEBA Number(19) DEFAULT 0 NOT NULL,
    IDPETICION Number(19) DEFAULT 0 NOT NULL,
    NPRUEBA Number(5) DEFAULT 0 NOT NULL,
    FECHA Date DEFAULT TRUNC(current_date,'DD') NOT NULL,
    IDPRUEBA Number(5) NOT NULL,
    IDPRUEBA_LISTA Number(5),
    IDPRUEBA_PERFIL Number(5),
    IDPACIENTE Number(10),
    TIPO Char(1 Char),
    NIVEL Number(5) DEFAULT 0 NOT NULL,
    PREFIJO VarChar2(20 Char),
    NRESULTADO Binary_Double,
    RESULTADO VarChar2(127 Char),
    TRESULTADO CLOB,
    FECHA_RESULTADO Timestamp(4),
    IDTIPORESULTADO Number(5) DEFAULT 0 NOT NULL,
    IDVALIDACION Number(5) DEFAULT 0 NOT NULL,
    FECHA_VALIDACION Timestamp(4),
    IDUSUARIO_VALIDA Number(5),
    PATOLOGIA Number(5) DEFAULT 0 NOT NULL,
    COMENTARIO VarChar2(512 Char),
    DELTA_CHECK Number(5) DEFAULT 0 NOT NULL,
    MARGEN_ULTIMO Number(5) DEFAULT 0 NOT NULL,
    IDEQUIPO Number(5) DEFAULT 0 NOT NULL,
    IDCENTROPROCESO Number(5) DEFAULT 0 NOT NULL,
    IDPRUEBAREF Number(10),
    ORDEN_IMPRESION Number(10) DEFAULT 0 NOT NULL,
    FECHA_INFORME Timestamp(4),
    IDUSUARIO_RESULTADO Number(5),
    FECHA_ALTA Timestamp(4),
    NREPETICION Number(5),
    IDPRUEBAMU Number(10),
    FECHA_PROCESO Timestamp(4),
    NPRUEBA_LISTA Number(5),
    NLISTA Number(5),
    REGISTRO_PROCESO Number(5),
    IDESTADORESULTADO Number(5),
    REGISTRO_PROTOCOLO Number(5),
    IDAREA Number(5),
    IDPETICIONMUESTRA Number(19),
    IDPRUINTERPRETACION Number(5),
    IMPRIMIR Number(5) DEFAULT 0,
    IDPETICION_ORIGEN Number(19),
    NPRUEBA_ORIGEN Number(5),
    NDOCUMENTO Number(5),
    IDVALIDACION_TECNICA Number(5),
    IDUSUARIO_VALIDACION_TECNICA Number(5),
    FECHA_VALIDACION_TECNICA Timestamp(4),
    IDPRUINTERPRETACIONRES Number(10),
    TRESULTADOE CLOB,
    IDINSTRUMENTO Number(5),
    NRESULTADO_CORREGIDO Binary_Double,
    IDSECCION Number(5),
    IDPETICIONPLATO Number(10),
    FECHA_ENTREGA Timestamp(4),
    PARAMETROS Number(5) DEFAULT 0,
    NALARMA Number(5),
    IDMETODO Number(5),
    IDUNIDAD Number(5),
    IDDOCUMENTO Number(19),
    FIRMA_DIGITAL VarChar2(512 Char),
    IDTIPOMUESTRAN Number(5),
    IDESTADOEXPORTACION Number(5),
    IDTUBO Number(5),
    FIRMA_DIGITAL_FECHA Timestamp(4), 
    CONSTRAINT PK_PET_PRUEBA PRIMARY KEY (
      IDPETICIONPRUEBA
    )
)
This is the content I try to input in TRESULTADO field (CLOB)

Code: Select all

Enterococcus faecium
     Positivo
   Sensible
         Gentamicina 500 (cmi <=500 )
         Cloranfenicol (cmi <=8 )
         Linezolid (cmi 2 )
         Tetraciclina (cmi <=1 )
         Minociclina (cmi <=1 )
         Tigeciclina (cmi 0.75 )
         Daptomicina (cmi 2 )
   Intermedio
         Nitrofurantoína (cmi 64 )
         Rifampicina (cmi 2 )
   Resistente
         Penicilina (cmi >8 )
         Ampicilina (cmi >8 )
         Amoxicilina + clavulanico (cmi >8/4 )
         Cloxacilina
         Oxacilina (cmi >2 )
         Ciprofloxacino (cmi >2 )
         Levofloxacino (cmi >4 )
         Gentamicina (cmi 8 )
         Tobramicina (cmi >8 )
         Amikacina (cmi >32 )
         Clindamicina (cmi >2 )
         Eritromicina (cmi >4 )
         Vancomicina (cmi >256 )
         Teicoplanina (cmi 32 )
         Norfloxacino (cmi >8 )
         Moxifloxacino (cmi >1 )
         Acido fusídico (cmi <=2 )
         Cotrimoxazol (sulfametoxazol y trimetoprim) (cmi >4/76 )
         Estreptomicina 1000 (cmi >1000 )
         Fosfomicina (cmi <=32 )
         Mupirocina (cmi <=256 )

Pseudomonas aeruginosa R
     Positivo.
   Sensible
         Piperacilina + tazobactam (cmi 16 )
         Aztreonam (cmi 4 )
         Ceftazidima (cmi 8 )
         Amikacina (cmi <=8 )
         Colistina (cmi <=2 )
   Intermedio
         Piperacilina (cmi 64 )
         Doripenem (cmi 4 )
         Cefepima (cmi 16 )
   Resistente
         Ampicilina (cmi >16 )
         Amoxicilina + clavulanico (cmi >16/8 )
         Ampicilina + sulbactam (cmi >16/8 )
         Imipenem (cmi >8 )
         Meropenem (cmi 8 )
         Ertapenem (cmi >1 )
         Ciprofloxacino (cmi >2 )
         Levofloxacino (cmi >4 )
         Cefalotina (cmi >16 )
         Cefoxitina (cmi >16 )
         Cefuroxima (cmi >16 )
         Cefotaxima (cmi >32 )
         Gentamicina (cmi >8 )
         Tobramicina (cmi 8 )
         Cloranfenicol (cmi >16 )
         Tetraciclina (cmi >8 )
         Minociclina (cmi >8 )
         Acido nalidíxico (cmi >16 )
         Nitrofurantoína (cmi >64 )
         Cotrimoxazol (sulfametoxazol y trimetoprim) (cmi >4/76 )
         Fosfomicina (cmi >64 )
If I remove some lines from the text, I can update the row without problem, for example:

Code: Select all

Enterococcus faecium
     Positivo
   Sensible
         Gentamicina 500 (cmi <=500 )
         Cloranfenicol (cmi <=8 )
         Linezolid (cmi 2 )
         Tetraciclina (cmi <=1 )
         Minociclina (cmi <=1 )
         Tigeciclina (cmi 0.75 )
         Daptomicina (cmi 2 )
   Intermedio
         Nitrofurantoína (cmi 64 )
         Rifampicina (cmi 2 )
   Resistente
         Penicilina (cmi >8 )
         Ampicilina (cmi >8 )
         Amoxicilina + clavulanico (cmi >8/4 )
         Cloxacilina
         Oxacilina (cmi >2 )
         Ciprofloxacino (cmi >2 )
         Levofloxacino (cmi >4 )
         Gentamicina (cmi 8 )
         Tobramicina (cmi >8 )
         Amikacina (cmi >32 )
         Clindamicina (cmi >2 )
         Eritromicina (cmi >4 )
         Vancomicina (cmi >256 )
         Teicoplanina (cmi 32 )
         Norfloxacino (cmi >8 )
         Moxifloxacino (cmi >1 )
         Acido fusídico (cmi <=2 )
         Cotrimoxazol (sulfametoxazol y trimetoprim) (cmi >4/76 )
         Estreptomicina 1000 (cmi >1000 )
         Fosfomicina (cmi <=32 )
         Mupirocina (cmi <=256 )
Another behaviour that I have observed is that if I set UseUnicode and UnicodeEnvironment to true, the error does not raise

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Sat 10 Dec 2016 14:01
by cointec
I have sent an example project that demonstrates the problem.
In the sample project there is one check box to enable or disable Unicode.
I have observed that if I check unicode I can execute the update query, but if I try to execute the update query without unicode, and the error raises, after that, if I connect using unicode, then I can't execute the query without error.
Database characterset is AL23UTF8

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Sat 10 Dec 2016 14:12
by cointec
I have found another interesting thing with Unidac. If I change the order of the parameters, I get another exception.
For example, If I use the next update statement, I get the subject error

Code: Select all

update Unidac_test.Pet_Prueba
set IDPACIENTE = :IDPaciente,
    FECHA = :Fecha, 
    RESULTADO = :RESULTADO, 
    PREFIJO = :Prefijo, 
    NRESULTADO = :NResultado, 
    TIPO = :TIPO, 
    NRESULTADO_CORREGIDO = :NResultado_Corregido,
   [b] TRESULTADO = :TRESULTADO, [/b]    
    TRESULTADOE = :TRESULTADOE, 
    PATOLOGIA = :Patologia, 
    IDTIPORESULTADO = :IDTipoResultado, 
    IDESTADORESULTADO = :IDESTADORESULTADO, 
    IDEQUIPO = :IDEQUIPO, 
    IDINSTRUMENTO = :IDINSTRUMENTO, 
    IDCENTROPROCESO = :IDCENTROPROCESO, 
    FECHA_RESULTADO = :FECHA_RESULTADO, 
    FECHA_PROCESO = :FECHA_PROCESO, 
    NALARMA = :NALARMA, 
    IDUSUARIO_RESULTADO = :IDUsuario_Resultado, 
    NREPETICION = :NRepeticion, 
    IDPRUEBAREF = :IDPruebaRef, 
    MARGEN_ULTIMO = :Margen_Ultimo, 
    DELTA_CHECK = :Delta_Check, 
    IDMETODO = :IDMetodo, 
    IDUNIDAD = :IDUnidad, 
    IDPRUEBAMU = :IDPruebaMU, 
    IDPRUINTERPRETACION = :IDPruInterpretacion,
    IDPRUINTERPRETACIONRES = :IDPruInterpretacionRes, 
    IDVALIDACION_TECNICA = :IDVALIDACION_TECNICA, 
    FECHA_VALIDACION_TECNICA = :FECHA_VALIDACION_TECNICA, 
    COMENTARIO = :COMENTARIO,  
    IDUSUARIO_VALIDACION_TECNICA = :IDUSUARIO_VALIDACION_TECNICA
where IDPETICIONPRUEBA = :IDPeticionPrueba
But if I move TRESULTADO to the end of the update statement, I get the error:
ORA-01483: invalid length for DATE or NUMBER bind variable

Code: Select all

update Unidac_test.Pet_Prueba
set IDPACIENTE = :IDPaciente,
    FECHA = :Fecha, 
    RESULTADO = :RESULTADO, 
    PREFIJO = :Prefijo, 
    NRESULTADO = :NResultado, 
    TIPO = :TIPO, 
    NRESULTADO_CORREGIDO = :NResultado_Corregido,
    TRESULTADOE = :TRESULTADOE, 
    PATOLOGIA = :Patologia, 
    IDTIPORESULTADO = :IDTipoResultado, 
    IDESTADORESULTADO = :IDESTADORESULTADO, 
    IDEQUIPO = :IDEQUIPO, 
    IDINSTRUMENTO = :IDINSTRUMENTO, 
    IDCENTROPROCESO = :IDCENTROPROCESO, 
    FECHA_RESULTADO = :FECHA_RESULTADO, 
    FECHA_PROCESO = :FECHA_PROCESO, 
    NALARMA = :NALARMA, 
    IDUSUARIO_RESULTADO = :IDUsuario_Resultado, 
    NREPETICION = :NRepeticion, 
    IDPRUEBAREF = :IDPruebaRef, 
    MARGEN_ULTIMO = :Margen_Ultimo, 
    DELTA_CHECK = :Delta_Check, 
    IDMETODO = :IDMetodo, 
    IDUNIDAD = :IDUnidad, 
    IDPRUEBAMU = :IDPruebaMU, 
    IDPRUINTERPRETACION = :IDPruInterpretacion,
    IDPRUINTERPRETACIONRES = :IDPruInterpretacionRes, 
    IDVALIDACION_TECNICA = :IDVALIDACION_TECNICA, 
    FECHA_VALIDACION_TECNICA = :FECHA_VALIDACION_TECNICA, 
    COMENTARIO = :COMENTARIO,  
    IDUSUARIO_VALIDACION_TECNICA = :IDUSUARIO_VALIDACION_TECNICA,
[b]    TRESULTADO = :TRESULTADO[/b]
where IDPETICIONPRUEBA = :IDPeticionPrueba
Both runs fine selecting Unicode.

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Sat 10 Dec 2016 18:15
by cointec
Another test with version 6.3.11.
Runs fine with and without unicode

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Mon 12 Dec 2016 12:45
by MaximG
Unfortunately we have not received your project demonstrating the described behavior. Please send this project together with the script to create DB objects used in it via the e-support form : https://www.devart.com (меню «Support»\«Request Support»).

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Mon 12 Dec 2016 13:01
by cointec

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Wed 14 Dec 2016 08:37
by MaximG
We investigated the sent project and made some changes to its code. When processing the TRESULTADO (CLOB) field value change we clearly specified the query parameter type :

Code: Select all

       ...
      QueryUpdate.SpecificOptions.Values['TemporaryLOBUpdate'] := 'True';
      QueryUpdate.ParamByName( 'TRESULTADO').DataType := ftOraClob;
      QueryUpdate.ParamByName( 'TRESULTADO').ParamType := ptInput;
      QueryUpdate.ParamByName( 'TRESULTADO').AsBlobRef.AsString := <your CLOB value>;
       ...
      Connection.Commit;
After this we successfully updated the PET_PRUEBA table data.
Try to make this change to your project code and check its operability.

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Wed 14 Dec 2016 09:37
by cointec
Thank you Maxim, but why runs on 6.3.11 and with parameter Unicode=True?.

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Fri 16 Dec 2016 08:00
by MaximG
Please specify whether these changes helped to solve the problem when using UniDAC 6.4.16 ?

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Wed 21 Dec 2016 08:40
by cointec
Hello, the changes have solved the problem.

Could you please explain what changes from version 6.3.11 have been made in the component? I have search for release note changes in oracle that may affect clob, but I have found nothing about this issue.

Re: ORA-01461: can bind a LONG value only for insert into a LONG column

Posted: Wed 28 Dec 2016 13:22
by MaximG
Unfortunately, during testing using the sent project we did not find any difference in behavior between the latest version and UniDAC 6.3.11. Any change in our components behavior is reflected in history : https://www.devart.com/unidac/revision_history.html We will further follow this rule.