Results 1 to 1 of 1
  1. #1
    Join Date
    Sep 2003

    Unanswered: how to insert data into nested table in Pro*C?

    Dear members,

    I am developing Pro*C based program and would like to ask about "inserting data into nested table".
    In my program, I declared two structures as follows:

    typedef struct {
    unsigned int service_class_id;
    unsigned int drop_probability;
    } service;

    typedef struct {
    unsigned char user_nai[72];
    service serviceclass[MAX_SERVICE_CLASS];
    } profile;

    Basically, I read "data" from text file and store it to the above structures.
    And I try to use the "data" in the structures in order to insert "data" to Oracle DB.

    In order to do that, I created a object called service_class_ty as follows:

    EXEC SQL CREATE TYPE service_class_ty AS OBJECT (
    service_class_id INTEGER,
    drop_probability INTEGER );

    EXEC SQL CREATE TYPE service_classes_nt AS TABLE OF service_class_ty;

    Then, created a table called user_profile as below:

    EXEC SQL CREATE TABLE user_profile (
    user_nai VARCHAR2(73)
    service_classes service_classes_nt
    EXEC SQL NESTED TABLE service_classes STORE AS service_classes_nt_tab;

    Finally, I tried to insert "data" to the above table as:

    for(i=1; i<=10; i++)

    : profile[i].user_nai,

    for(j=1; j<=10; j++)
    THE(SELECT service_classes FROM user_profile WHERE user_nai = : profile[i].user_nai)
    VALUES( : profile[i].serviceclass[j].service_class_id,
    : profile[i].serviceclass[j].drop_probability);


    I met the following error message when I runned the above program.

    Oracle error detected:
    ORA-02315: incorrect number of arguments for default constructor

    Could anybody have some comments how to insert data into nested table? Many thanks in advances.
    Last edited by iamyun1; 09-17-03 at 23:48.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts