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 -> Re: How to pass an array as function parameter

Re: How to pass an array as function parameter

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Thu, 19 Jul 2007 22:12:27 +0200
Message-ID: <469FC5AB.80003@gmail.com>


Mariano schrieb:
> 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.
>

How about SELECT * FROM TABLE (semiauto( SINARRAY(1) )) ?

Best regards

Maxim Received on Thu Jul 19 2007 - 15:12:27 CDT

Original text of this message

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