Does the Database Toolbox support sql numeric ARRAY data types?

1 visualización (últimos 30 días)
Neil Caithness
Neil Caithness el 21 de En. de 2016
Comentada: the cyclist el 29 de En. de 2016
Can anyone confirm inserting a matlab array into a database ARRAY field. I've not been able to do this with datainsert. I have done it by iterating over an sql query, but then I can't read it back again.
I have a matlab table that looks like this:
mpan meternumber date bin
_______________ ____________ ____________ _____________
'1012345738980' 'E12Z047967' '2016-01-17' [1x48 double]
'1012345874229' 'E11Z84795' '2016-01-14' [1x48 double]
'1012345874229' 'E11Z84795' '2016-01-15' [1x48 double]
'1012345874229' 'E11Z84795' '2016-01-16' [1x48 double]
'1012345874229' 'E11Z84795' '2016-01-17' [1x48 double]
'1012346434737' 'E11Z106965' '2016-01-14' [1x48 double]
'1012346434737' 'E11Z106965' '2016-01-15' [1x48 double]
'1012346434737' 'E11Z106965' '2016-01-16' [1x48 double]
'1012346434737' 'E11Z106965' '2016-01-17' [1x48 double]
'1012346453590' 'E11Z28462' '2016-01-17' [1x48 double]
An sql table defined like this:
CREATE TABLE consdata ( mpan VARCHAR(13), meternumber VARCHAR(12), date DATE, bin NUMERIC ARRAY[48], PRIMARY KEY (mpan, meternumber, date) );
And I get the following when I try to insert the data:
datainsert(conn,'consdata',data.Properties.VariableNames,data)
Error using database/DatabaseUtils/validateStruct (line 95)
Input structure, dataset or table incorrectly formatted. See help for details
Error in database.ODBCConnection/insert (line 118)
data = database.DatabaseUtils.validateStruct(data);
Error in database.ODBCConnection/datainsert (line 40)
insert( connect,tableName,fieldNames,data );
  2 comentarios
Tony L.
Tony L. el 29 de En. de 2016
I'm getting the same error when inserting dates and VARCHAR data into a table.
Inserting only VARCHAR data into a second table works.
Inserting only dates into a 1 column table (type DATE) gives me this error:
ODBC Driver Error: [Oracle][ODBC]Datetime field overflow.
My guess is that this issue is related to the date format. I'll come back if I find a solution.
the cyclist
the cyclist el 29 de En. de 2016
Only adding this comment so that I can easily see if there is any response. (My guess is that SQL arrays cannot be handled easily, but would love to be proved wrong.)

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by