0

Hi I have two arrays as input. I want to insert into a table using loop. This is what I have tried.

simple_loop:LOOP

SET i = i + 1;
     simples_loop:LOOP
     SET j = j + 1;
     INSERT INTO ROLE_PRIVILEGE_BRIDGE (ROLE_ID,PRIVILEGE_ID,VALUE)
        VALUES(V_ROLE_FK,p_privilege_fk(i),p_values(j));
     END LOOP simples_loop;
END LOOP simple_loop;

This is just the portion of the procedure I have written. When executed the query an error showed up saying that ".p_privilege_fk() function does not exist.". Can anyone please help.

1 Answer 1

3

Try something like this:

INSERT INTO ROLE_PRIVILEGE_BRIDGE (ROLE_ID,PRIVILEGE_ID,VALUE) 
    (SELECT V_ROLE_FK, p_privilege_fk, p_privilege_fk FROM firstTable) 
Sign up to request clarification or add additional context in comments.

1 Comment

INSERT INTO ROLE_PRIVILEGE_BRIDGE (ROLE_ID,PRIVILEGE_ID,VALUE) SELECT V_ROLE_FK, p_privilege_fk, p_privilege_fk FROM firstTable

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.