Oracle SQL problem (newbie)

Status
Not open for further replies.

orestis

Ars Tribunus Militum
1,598
I'm trying to use multiple cursor loops to do some stuff. I don't really know SQL or Oracle, I'm going blindly here. Anyway, here is the code:

Code:
FOR Task_Id IN c1(job_id) LOOP
    FOR PreconId IN c3(Task_Id) LOOP
        FOR task_order_id2 IN c5(Task_Id,job_id,job_order_id) LOOP
            FOR task_order_id1 IN c4(PreconId,job_id,job_order_id) LOOP

                INSERT INTO TASK_ORDER_CONSTRAINTS
                            (TASKORDER1 , TASKORDER2)
                    VALUES (task_order_id1 , task_order_id2);

            END LOOP;
        END LOOP;
    END LOOP;
END LOOP;

The problem is that the database refuses to accept the Task_Id in the second row as an argument by passing an error like:

Wrong type or number of arguments in call to c3, though they are the same type and number. can anyone help me ? I'm thinking of using temporary tables to implement if this can't work... Any help ?
 

Alexandre

Ars Tribunus Militum
1,781
Subscriptor
From what I understood, you are using record groups (Task_Id, PreconId, task_order_id2 and task_order_id1 are record groups with the collumns of the cursors lc(), c3(), c5() and c4() respectively (sp?)). So you must put the collumn name of these RGs in the INSERT statement, something like:

Code:
INSERT INTO TASK_ORDER_CONSTRAINTS
            (TASKORDER1 , TASKORDER2)
    VALUES (task_order_id1.<collumn_name> , task_order_id2.<collumn_name>);

Hope I could help.

[Edit] Yeah, like Erzan said, you must use the collumn names when opening the cursors too.
 
Status
Not open for further replies.