Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Firebird e Interbase (https://www.clubdelphi.com/foros/forumdisplay.php?f=19)
-   -   SQL error code = -303 ¿como solucionar? (https://www.clubdelphi.com/foros/showthread.php?t=24116)

pjjorda 09-08-2005 13:13:10

SQL error code = -303 ¿como solucionar?
 
Saludos cordiales,
tengo en una tabla firebird 1.5, un campo definido como MIN01 NUMERIC(3,2),
y le asigno el valor 480 y me da el error del título.

Lo hago así: TABLA.FIELDBYNAME('MIN01').ASFLOAT:=480;
y al hacer TABLA.POST; da el error.

también desde IBEXPERT le intento poner el valor al campo, y al cambiar de registro da el mismo error.

Agradecería información de donde conseguir el listado de los errores de SQL,
o si me decís como solucionar este error puntual.

Gracias por anticipado.

ContraVeneno 09-08-2005 16:39:36

Esto fue lo que encontre con una pequeña búsqueda en yahoo sobre "SQL Error Codes", espero que te pueda servir.

Cita:

Empezado por el Link anterior: Error 303
A FETCH, SELECT, CALL, SET, or VALUES INTO cannot be performed because the data type of host variable &2 is not compatible with the data type of the corresponding list item.
  • When selecting a date value, a character host variable must be at least 6 bytes for a Julian date, at least 8 bytes for a date in the MDY, YMD, DMY formats, or at least 10 bytes for all other formats.
  • When selecting a time value, a character host variable must be at least 8 bytes for a time in the USA format and at least 5 bytes for all other formats.
  • When selecting a timestamp value, a character host variable must be at least 19 bytes.
  • If the host variable is C NUL-terminated and the program was compiled with *CNULRQD option, then an additional byte is required for the NUL-terminator for date/time values.
  • The relative position of the host variable in the INTO clause, the SQLDA, or the CALL statement is &1. If the host variable name is *N, an SQLDA was specified on a FETCH statement.
Ensure that the data types are compatible for each of the corresponding list items. Ensure the host variables are defined correctly for date, time, and timestamp values.

Más información sobre Códigos de error en SQL (en ingles)

¿porque no pruebas asignar 480.00 en lugar de solo 480? Igual y funciona.

rastafarey 09-08-2005 16:45:48

Resp
 
En los manuales de interbase 6 hay un listado de todos los errores.

Bajatelos aqui

ContraVeneno 09-08-2005 16:48:33

Prueba tambien hacer esto:
TABLA.FieldValues['MIN01']:=480;

cahp 09-08-2005 18:24:50

Hola,

Por lo que tengo entendido, InterBase guarda el físicamente el valor como smallint, integer o double precision.

Precision de 1 a 4 smallint, de 5 a 9 integer y partir de 9 double

Tu campo definido como MIN01 NUMERIC(3,2), lo multiplica por 100 para guardarlo y guarda la escala (el numero de decimales) en una tabla del sistema para despues restaurar el numero original.

Saludos.

pjjorda 10-08-2005 11:08:49

Gracias a todos,
intenté grabar 480,00 y me da el mismo error,
en el fichero LANGREF.PDF de la documentación de Interbase no he visto el error -303,
y en la respuesta de Contraveneno hace referencias a campos date,time, etc.
He cambiado la definición del campo de NUMERIC (3,2) a (5,2) y a funcionar, me parece un poco raro.

Repito las GRACIAS, da gusto ver que hay personas dispuestas a ayudar a los que estamos empezando.

rastafarey 11-08-2005 18:38:25

resp
 
Si no puedes con el enemigo unetele.

Declara el campo como double prescion


La franja horaria es GMT +2. Ahora son las 02:03:08.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi