0

I have script of creating here:

create type Ingredients_type as object (
Ingredient_ID varchar2(20),
Ingredient_Name varchar2(50),
ICalori int,
IPretein int);

create type Food_type as object (
FoodType_ID varchar2(20),
FoodType_Name varchar2(50));

create type FoodIngredients_type as object (
Ingredients Ingredients_type,
Amount int);

create type FoodIngredients_table as table of FoodIngredients_type;

create table Foods(
Food_ID varchar2(20),
Food_Name varchar2(50),
FType Food_type,
FIngredients FoodIngredients_table,
Cost int,
FCalori int,
FProtein int)
nested table FIngredients store as FIngredients_col;

But I can't insert values into Foods. I have counted enough arguments and don't know where is missing or redundancy...

insert into Foods values ('F1', 'Food #1', Food_type('FT1', 'Noodle'),
FoodIngredients_table(FoodIngredients_type(Ingredients_type('I1','Ingredient #1', 0, 0), 10,
                                           Ingredients_type('I2','Ingredient #2', 0, 0), 20)), 
                                           1000, 0, 0);

1 Answer 1

1

A simple mistake, I forget to call FoodIngredients_type. Sorry for disturbing all again.

insert into Foods values ('F1', 'Food #1', Food_type('FT1', 'Noodle'),
FoodIngredients_table(FoodIngredients_type(Ingredients_type('I1','Ingredient #1', 0, 0), 10),
                      FoodIngredients_type(Ingredients_type('I2','Ingredient #2', 0, 0), 20)), 
                                           1000, 0, 0);
1
  • 1
    Please accept your answer so that the system knows that the question is Not Open anymore.
    – miracle173
    Commented Jun 10, 2017 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.