Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> How to pass an array as function parameter

How to pass an array as function parameter

From: Mariano <mariano.calandra_at_gmail.com>
Date: Thu, 19 Jul 2007 12:27:15 -0700
Message-ID: <1184873235.527169.285540@k79g2000hse.googlegroups.com>


I've to write a function with new type, then I create new type:

CREATE TYPE automatica AS OBJECT (id_mal NUMBER ,percent NUMBER) CREATE TYPE automatiche AS TABLE OF automatica CREATE TYPE sinArray AS TABLE OF number

And finally the real function:



FUNCTION "SEMIAUTO"(px SINARRAY)

    RETURN automatiche AS

    results automatiche := automatiche();

    CURSOR c_class IS

        SELECT id_mal, SUM(percent) AS p
        FROM malattie_sintomi
        WHERE id_sin IN ( SELECT column_value FROM TABLE(CAST(px as
SINARRAY)) )
        and id_mal in (select id_mal from malattie_sintomi group by
id_mal having count(*) >= 1)
        GROUP BY id_mal;

    BEGIN
        FOR v_Rec IN c_class LOOP
            results.EXTEND;
            results(results.LAST) := automatica(v_Rec.id_mal,
v_Rec.p);
        END LOOP;

    RETURN results;
    END;

My problem is: how can I use this function???? Using:
SELECT * FROM TABLE (semiauto( (1) ))
I obtain:
ORA-06553: PLS-306: wrong number or types of arguments in call to 'SEMIAUTO' PS: Function compile without problem. Received on Thu Jul 19 2007 - 14:27:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US