Wednesday, September 30, 2020

RDBMS PLSQL Program 25 Function with parameter, return value and program to call it

Function

================================================

 CREATE or REPLACE FUNCTION fun1(veno in varchar) 

RETURN varchar2

IS

    name emp.ename%type;

BEGIN

    select ename into name from emp where eno = veno;

    return name;

END;

/

Program to call above function

=============================================

set serveroutput on

DECLARE

    veno emp.eno%type;

    name emp.ename%type;

BEGIN

    veno := '&veno';

name := fun1(veno);

    dbms_output.put_line('Name:'||'   '||name);

    end;

/

No comments:

Post a Comment

Thanks for showing your interest
I will shortly get back to you