Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: HELP : PL/SQL SPEED Functions
In article <7prj17$s8g$1_at_pan.ipb.pt>,
Joao Ricardo B Oliveira <jricardo_at_ipb.pt> wrote:
> I've created a function to get the description of a product, by
> entering the ID... this function is used several times by al the
> application... > I've speed problems, when in my application (FORMS
> 4.5) invoke the function for example :
>
> :order.description:=func_get_description(:order.ID)
>
> If i write the function code in the POST_CHANGE trigger is MUCH
> FASTER than invoking the function. Shouldnt be the opposite ?
>
>------------------------------------------
> the function have the follow code:
>
> function func_get_description(xid number)
> return char
> desc varchar2(80)
> begin
> select description into desc
> from prod
> where id=xid;
> exception
> when no_data_found then
> return('Not Found');
> end func_get_description;
>------------------------------------------
I assume your actual function has a RETURN before the exception.
There should be no difference in speed, if you table is small or you have a primary key on id. The speed problem is probably due to some other situation, perhaps a full-table scan in a post-query trigger.
Steve Cosner