exec only works with procedures. you can execute a function by calling to from sql as such
select emp_sel('gali') from dual; or with a pl/sql block declare resex varchar2(3); begin resex := emp_sel('gali'); end; > > From: purushottam krishna hegde <[EMAIL PROTECTED]> > Date: 2003/06/06 Fri AM 07:35:11 EDT > To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> > Subject: procedure/function error > > hi all, > this is purushottam hegde from Bangalore(IND) > i am relatively new to oracle and so to this group. > iam having a problem with function... > it goes like this. > > > > SQL> CREATE OR REPLACE FUNCTION EMP_SEL(ename IN Varchar2) return varchar2 is > 2 resex varchar2(3); > 3 Begin > 4 SELECT sex into resex from emp where name=ename; > 5 return(resex); > 6 END; > 7 / > Function created. > > SQL> EXECUTE EMP_SEL('gali'); > BEGIN EMP_SEL('gali'); END; > * > ERROR at line 1: > ORA-06550: line 1, column 7: > PLS-00221: 'EMP_SEL' is not a procedure or is undefined > ORA-06550: line 1, column 7: > PL/SQL: Statement ignored > > > > pl help me in this regard > > thanking all of u > > purushottam hegde > > > > > --------------------------------- > Do you Yahoo!? > Free online calendar with sync to Outlook(TM). >
hi all,
this is purushottam hegde from Bangalore(IND)
i am relatively new to oracle and so to this group.
iam having a problem with function...
it goes like this.
SQL> CREATE OR REPLACE FUNCTION EMP_SEL(ename IN Varchar2) return varchar2 is
2 resex varchar2(3);
3 Begin
4 SELECT sex into resex from emp where name=ename;
5 return(resex);
6 END;
7 /
2 resex varchar2(3);
3 Begin
4 SELECT sex into resex from emp where name=ename;
5 return(resex);
6 END;
7 /
Function created.
SQL> EXECUTE EMP_SEL('gali');
BEGIN EMP_SEL('gali'); END;
BEGIN EMP_SEL('gali'); END;
*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00221: 'EMP_SEL' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00221: 'EMP_SEL' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
pl help me in this regard
thanking all of u
purushottam hegde
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).