SQL> create or replace function fun_two( num in number)
2 return number
3 as
4 val number;
5 begin
6 val:=num+500;
7 return val;
8 end;
9 /
Function created.
SQL> create or replace function fun_one( num in number)
2 return number
3 as
4 val number;
5 begin
6 val:=fun_two(num);
7 return val;
8 end;
9 /
Function created.
SQL> select fun_one(10) from dual;
FUN_ONE(10)
-----------
510
SQL> select fun_one(30) from dual;
FUN_ONE(30)
-----------
530
2 return number
3 as
4 val number;
5 begin
6 val:=num+500;
7 return val;
8 end;
9 /
Function created.
SQL> create or replace function fun_one( num in number)
2 return number
3 as
4 val number;
5 begin
6 val:=fun_two(num);
7 return val;
8 end;
9 /
Function created.
SQL> select fun_one(10) from dual;
FUN_ONE(10)
-----------
510
SQL> select fun_one(30) from dual;
FUN_ONE(30)
-----------
530
***********************************
SQL> declare
2 function bob(x number) return number is
3 begin
4 return x*x;
5 end;
6 function fred(x number) return number is
7 begin
8 return x+bob(x);
9 end;
10 begin
11 dbms_output.put_line('Value: '||to_char(fred(5),'fm9999'));
12 end;
13 /
Value: 30
PL/SQL procedure successfully completed.
SQL>
No comments:
Post a Comment