Why can't I complete this insert query when a specific field value is set to null?

I missed the database and I have the following problem trying to implement a simple insert query that inserts a new record into an Oracle database.

So my table has the following structure:

DESCRIBE FLUSSO_XMLSDI

Nome           Nullo    Tipo         
-------------- -------- ------------ 
NUMERO_FATTURA NOT NULL VARCHAR2(15) 
DATA_EMISSIONE          DATE         
XML                     CLOB         
PFK_PIVA                VARCHAR2(16) 
PDF                     VARCHAR2(1)  

      

So, as you can see, the last field of this table is called PDF and it is null and it is 1 character long (it is defined as VARCHAR2 (1 BYTE) , but I think that means it can only contain a character ).

So my problem is, if I do this:

INSERT INTO FLUSSO_XMLSDI (NUMERO_FATTURA, DATA_EMISSIONE, XML, PFK_PIVA, PDF) 
       VALUES (004600002149, date'2015-03-16', 'TEST' , 80003690668, 'S');

      

It works and the new record is correctly inserted into my FLUSSO_XMLSDI table .

But when I try to do (by setting the PDF field to null):

INSERT INTO FLUSSO_XMLSDI (NUMERO_FATTURA, DATA_EMISSIONE, XML, PFK_PIVA, PDF) 
       VALUES (004600002149, date'2015-03-16', 'TEST' , 80003690668, null); 

      

I am getting the following error:

Errore con inizio alla riga 1 nel comando:
INSERT INTO FLUSSO_XMLSDI (NUMERO_FATTURA, DATA_EMISSIONE, XML, PFK_PIVA, PDF) 
       VALUES (004600002149, date'2015-03-16', 'TEST' , 80003690668, null)
Report errori:
Errore SQL: ORA-01403: no data found
ORA-06512: at "EDIWEA.TRI_P_FLUSSO", line 10
ORA-04088: error during execution of trigger 'EDIWEA.TRI_P_FLUSSO'
01403. 00000 -  "no data found"
*Cause:    
*Action:

      

Why can't I specify that the PDF field value is null also if it is NULL? What am I missing? How can I fix this problem?

+3


source to share


1 answer


This type of error no data found

 ORA-04088: error during execution of trigger 'EDIWEA.TRI_P_FLUSSO'

      



can be called from select * into variable from dual

and its returning nulls, select has to return records in b appended to variables, so you either need to adjust the selection to return values ​​or comment them out, which is why triggers work.

there are other reasons for this error, we cannot help you unless you show us the trigger.

+1


source







All Articles