sql - Why I can't perform this simple insert operation? How can I solve this date format issue? -


i not database , have following problem trying implement simple insert query involve date field on oracle database.

so have table named flusso_xmlsdi have following structure (this result of select *):

numero_fattura    data_emissione    xml ----------------------------------------------------------- 2502064160        11-gen-2014       text 2502064161        15-gen-2014       text 2502064162        25-gen-2014       text 

where data_emissione field date type.

now, have insert new record using values extracted xml , this:

insert flusso_xmlsdi (numero_fattura, data_emissione, xml) values (2503985924, 2015-06-16, 'test'); 

but have problem data_emissione field because obtain following error message trying performing previous query:

errore con inizio alla riga 3 nel comando: insert flusso_xmlsdi (numero_fattura, data_emissione, xml)  values (2503985924, 2015-06-16, 'test')  errore alla riga del comando:4 colonna:27 report errori: errore sql: ora-00932: inconsistent datatypes: expected date got number 00932. 00000 -  "inconsistent datatypes: expected %s got %s" *cause:     *action: 

as can see in data obtained select operation data_emissione field contains date in format: 11-gen-2014 trying insert 2015-06-16 (because how application obtain value xml)

is problem? there not sort of automatic conversion between different data format automatically performed oracle? how can solve issue , correctly perform insert statment?

2015-06-16 number, indeed. specifically, 1993 (2015 minus 6 minus 16).

what need ...

insert flusso_xmlsdi (numero_fattura, data_emissione, xml) values (2503985924, date'2015-06-16', 'test'); 

... if want use date literal constant, or (more probable, since data xml elsewhere) ...

insert flusso_xmlsdi (numero_fattura, data_emissione, xml) values (2503985924, to_date('2015-06-16', 'yyyy-mm-dd'), 'test'); 

... if want use character string value, possibly bind variable.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -