Skip to content
Advertisement

how to resolve this type of error when inserting a new row in a table?

CREATE OR REPLACE TYPE hypothesis AS TABLE OF VARCHAR2(20);
/
CREATE OR REPLACE TYPE Hypoth_pr AS OBJECT (prob_content VARCHAR2(20), pr NUMBER);
/
CREATE OR REPLACE TYPE Hypoth_po AS OBJECT (possib_content VARCHAR2(20), po NUMBER);
/
CREATE OR REPLACE TYPE focal_element AS OBJECT(focal_element_content hypothesis, focal_element_mass NUMBER);
/
CREATE OR REPLACE  TYPE bba AS TABLE OF focal_element;
/
CREATE OR REPLACE TYPE Pr_Dist AS TABLE OF Hypoth_pr;
/
CREATE OR REPLACE TYPE po_Dist AS TABLE OF Hypoth_po;
/
CREATE OR REPLACE TYPE confidence_level AS OBJECT(bel NUMBER, pl NUMBER);
/
CREATE TABLE edb (pid VARCHAR2(10) PRIMARY KEY, Disease bba, Symptom Pr_Dist, Age po_Dist, cl CONFIDENCE_LEVEL)
NESTED TABLE Disease STORE AS Diseases (NESTED TABLE focal_element_content STORE AS focal_element_contents_fs),
NESTED TABLE Symptom STORE AS Symptoms
NESTED TABLE Age STORE AS Ages;
/
INSERT INTO edb VALUES ('2', bba(focal_element(hypothesis('Pneumonia',0.2)), focal_element(hypothesis('Cold','Fever'),0.6)),
pr_Dist(Hypoth_pr('Cough',0.5), Hypoth_pr('Headcaches',0.5)),
po_Dist(Hypoth_po('Old',1), Hypoth_po('Teenager',0.7)), 
CONFIDENCE_LEVEL(0.4,0.8));

Erreur à la ligne de commande: 26 Colonne: 34 Rapport d’erreur – Erreur SQL : ORA-02315: nombre d’arguments non valide pour constructeur par défaut 02315. 00000 – “incorrect number of arguments for default constructor” *Cause: The number of arguments specified for the default constructor doesn’t match the number of attributes of the object type. *Action: Specify the correct number of arguments for the default constructor and retry the operation.

Advertisement

Answer

You wanted to use double focal_element for bba, but using redundant closing parentheses for the first one corrupts the syntax as focal_element(hypothesis('Pneumonia') ,0.2)) -->^

Try Insert statement below :

INSERT INTO edb VALUES ('2', 
bba(focal_element(hypothesis('Pneumonia')   ,0.2), 
    focal_element(hypothesis('Cold','Fever'),0.6) ),
pr_Dist(Hypoth_pr('Cough',0.5), Hypoth_pr('Headcaches',0.5)),
po_Dist(Hypoth_po('Old',1), Hypoth_po('Teenager',0.7)), 
CONFIDENCE_LEVEL(0.4,0.8));
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement