Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: please help me out...
"execute shipfunct(179, U)" can be used if "shipfunct" is a procedure.
Since it is a function,
try "select shipfunct(179, 'U') from dual;" in SQL*Plus. Note that the
parameter U need to be quoted.
"Oracle_learner" <grad_ra_at_yahoo.com> wrote in message
news:4ca14853.0305100038.524bc920_at_posting.google.com...
> hello people,
> I am new to PL/SQL and i have a question. I have a function
> shipfunct(item_no integer, shiptype char) which is as:
> create or replace function shipfunct (item_no integer, shiptype char)
> return number is
> price number;
> itemprice number;
> invalid exception;
> begin
> price := 0;
> select lastbid into itemprice from ITEMS where INO=item_no;
> if(shiptype='U') then
> price := itemprice * 0.1;
> elsif(shiptype='P') then
> price := itemprice * 0.02;
> else raise invalid;
> end if;
> return price;
> exception
> when NO_DATA_FOUND then
> raise_application_error(-20010, 'Item number ' ||
> to_char(item_no) || ' does not exists.');
> when invalid then raise_application_error(-20011,
> 'SHIPTYPE is invalid.');
> end shipfunct;
> /
> how do i execute this. I say execute shipfunct(179, U). But I get this
> error:
> ERROR at line 1:
> ORA-06550: line 1, column 7:
> PLS-00306: wrong number or types of arguments in call to 'SHIPFUNCT
> ORA-06550: line 1, column 7:
> PL/SQL: Statement ignored
>
![]() |
![]() |