Home » SQL & PL/SQL » SQL & PL/SQL » newbie problems with plsql...:)
newbie problems with plsql...:) [message #237132] Sat, 12 May 2007 09:31 Go to next message
roger99
Messages: 2
Registered: May 2007
Junior Member
hello
i am receiving error (showed below) in simple plsql function, which should only return true if values (kolor and kolor_oczu) are the same and false if they are not, but something is wrong, .....i am newbie, please help Smile

9/9
PLS-00103: Encountered the symbol "=" when expecting one of the following:
 
   . ( * @ % & = - + < / > at in is mod remainder not rem then
   <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
   LIKE4_ LIKEC_ between || multiset member SUBMULTISET_



function...


create or replace type body osoba as
 
member function daj_imie_i_nazwisko return varchar2
is begin
return self.imie || '  ' || self.nazwisko;
end;
 
member function czy_kolor_oczu return boolean is begin
if kolor:=self.kolor_oczu then return true;
else 
return false;
end if;
end czy_kolor_oczu;
 
member procedure zmien_kolor(nowy varchar2) is begin
self.kolor_oczu:=nowy;
end;
 
member procedure zmien_date(nowa date) is begin
self.data_ur:=nowa;
end;
end;
/ 
 



this is function definition:
member function czy_kolor_oczu(kolor varchar2) return boolean

thanks

Re: newbie problems with plsql...:) [message #237155 is a reply to message #237132] Sat, 12 May 2007 14:15 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It is " = " to be used in the IF statement, not " := ".

BTW, it is easier to put it simply as
RETURN (kolor = kolor_oczu);
If those colors are the same, the function will return TRUE; otherwise, it will return FALSE. No need to use IF-THEN-ELSE construct.
Re: newbie problems with plsql...:) [message #237161 is a reply to message #237155] Sat, 12 May 2007 15:12 Go to previous messageGo to next message
roger99
Messages: 2
Registered: May 2007
Junior Member
mhm, thanks but...
now i've got more errors like


PLS-00539: subprogram 'CZY_KOLOR_OCZU' is declared in an object type body and mu
st be defined in the object type specification

...the same for other function. I had created a type specyfication with specified CZY_KOLOR_OCZU function but even though it shows an error

create or replace type osoba as object
(
imie	varchar2(20),
nazwisko	varchar2(20),
data_ur	date,
wzrost	integer,
kolor_oczu	varchar2(10),
adres	t_adres,
member function daj_imie_i_nazwisko return varchar2,
member function czy_kolor_oczu (kolor varchar2) return boolean,
member procedure zmien_kolor (nowy varchar2),
member procedure zmien_date_ur (nowa date)
);
/


Re: newbie problems with plsql...:) [message #237163 is a reply to message #237132] Sat, 12 May 2007 15:30 Go to previous message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
I suggest you try 1 or 2 courses of action.
1) visit http://asktom.oracle.com for many fine coding examples
2) Read The Fine PL/SQL Reference Manual found at http://tahiti.oracle.com

If you can't get straight forward syntax correct, how/why do you expect to get program logic correct?
Previous Topic: Infinite Cursor Loop
Next Topic: what Bitand Function ????
Goto Forum:
  


Current Time: Thu Dec 08 18:44:39 CST 2016

Total time taken to generate the page: 0.09280 seconds