function cannot be called with EXEC. u have to call it within a
procedure...
-Original Message-From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]On Behalf Of purushottam krishna
hegdeSent: Friday, June 06, 2003 5:05 PMTo: Multiple
recipients of list ORACLE-LSubject:
Hi
purushotam,
since
it is a function that you are creating , its return value needs to be
collected.
hence
after BEGIN clause give a statement like
v_ret:=EMP_SEL('gali'); where v_ret
is a local variable of type varchar2
Thiswill work.
Regards
Kesh
-Original
The error message tells you all: EMP_SEL is not a procedure, it's a function.
You cannot execute functions like that. Functions are called and not executed.
try something like
declare
ret varchar2(3);
begin
ret:=emp_sel('gali');
dbms_output.put_line('RET:'||ret);
end;
/
On 2003.06.06 07:35
declarea varchar2(20); b:=varchar2(20):='gali'; begin a:=EMP_SEL(b); dbms_output.put_line(a); end;
You cannot call the functions like this, only procedures can be.Venkat
- Original Message -
DATE: Fri, 06 Jun 2003 03:35:11
From: purushottam krishna hegde [EMAIL
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
you
need to accept the return value of the function in a variable. the correct way
to do is
SQL var a varchar2(1000)
sql execute :a := emp_sel('gali')
SQL print a
OR
SQLdeclare
SQLa varchar2(1000);
SQLbegin
SQLa := emp_sel('gali');
SQLDBMS_OUTPUT.PUT_LINE(a);
SQLend;
SQL/
Regards
Naveen
Functions CAN be called from SQL*Plus like this ...
create the function
---
create or replace function emp_sel(e IN VARCHAR2) RETURN VARCHAR2 IS
cName VARCHAR2(32);
BEGIN
SELECT INITCAP(ename) INTO cName FROM EMP WHERE ename = e;
RETURN (cName);
END;
/
in SQL*Plus do
slight correction
SQL:x := emp_sel('SCOTT');
has to be changed to :-
SQL exec :x := emp_sel('SCOTT');
sorry ... cutpaste problem from sqlplus output !!!
-Original Message-
Sent: Friday, June 06, 2003 9:51 AM
To: '[EMAIL PROTECTED]'
Functions CAN be called from SQL*Plus like