Skip to content
Advertisement

How to test PL/SQL procedure with varray input

I’ve made a procedure that uses a varray as input, and while everything compiles correctly, I can’t figure out how exactly to test/execute the procedure that actually works. The varray takes in at least two values: the first is an event ID (eid), and any other after are person IDs (pid). Both are numbers with max 38 digits.

I’m used to having a statement at the end like exec event_attendees(3,9); work correctly, but it gave me an error.

Screenshot of error message from running this statement

I’d like to make different test cases to make sure each of the if/else parts work (one with an invalid eid, one with an invalid pid, one with an eid and pid combination already part of the table, and one which should cause no errors). Why doesn’t the exec statement I tried work, and how can I test multiple different values in my varray?

This is what I have so far:

Advertisement

Answer

You need to construct a VARRAY first. You can re-construct it with different values and re-call your stored procedure. Try the following.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement