I am pretty new in database and I have the following problem trying to implement an insert query that create a row into a table named CODA_RX that have the following structure (obtained by performing the describe CODA_RX statment:
Name Null Type
----------------------------- -------- --------------
PK_CODA NOT NULL NUMBER(10)
FK_TIPO_DOC NUMBER(4)
FK_PIVA_DESTINATARIO VARCHAR2(16)
FK_CDZZ VARCHAR2(4)
DATA_IN DATE
DATA_OUT DATE
NUM_DOC VARCHAR2(35)
FK_STATO NOT NULL NUMBER(2)
CANALE VARCHAR2(3)
SIZE_XML NUMBER(10)
FK_PIVA_MITTENTE VARCHAR2(20)
INDIRIZZAMENTO VARCHAR2(100)
SEGNALAZIONE VARCHAR2(4000)
FORNITORE VARCHAR2(100)
MATRICOLA_VERIFICATORE VARCHAR2(16)
MATRICOLA_APPROVATORE VARCHAR2(16)
DATA_INSERIMENTO_VERIFICATORE DATE
DATA_LAVORAZIONE_APPROVATORE DATE
MOTIVO_RIFIUTO VARCHAR2(1000)
TOT_FATTURA NUMBER(10,2)
DATA_DOC DATE
DATA_SCADENZA_DOC DATE
CIG VARCHAR2(10)
CUP VARCHAR2(15)
Ok, it seems that the only 2 field that can not be NULL are the PK_CODA (that I think is the primary key of the table, is it right? how can I check it?) and the FK_STATO fields.
So I want to insert a new record into this table. If the PK_CODA is the primary key I think that it shoud be automatically generated by Oracle.
So I tryied to perform this statment that insert a new record setting only the FK_STATO field:
insert into CODA_RX (FK_STATO) values (2);
But the problem is that I obtain this error message:
Errore con inizio alla riga 5 nel comando: insert into CODA_RX (FK_STATO) values (2) Report errori: Errore SQL: ORA-01400: cannot insert NULL into ("EDIADD"."CODA_RX"."PK_CODA") 01400. 00000 - "cannot insert NULL into (%s)" *Cause:
*Action:
So it seems that the PK_CODA field can not be null, so what it means that it is not automatically generated when I try to insert a new record into the table? Or there is some other syntax error into my insert query? What am I missing?
Tnx