Tuesday, May 14, 2019

How to write and call PL/SQL function in SQL script using WITH clause?

Example# 1:



WITH
FUNCTION voter(age NUMBER) Return VARCHAR2
IS
BEGIN
If(age > 18) THEN
RETURN 'Eligible for voting.';
ELSE
RETURN 'Not eligible for voting.';
END if;
END;
--

SELECT voter(19) FROM dual;
--

Output:

Eligible for voting. 

Note:

In this case PL/SQL function object not saved or created. We must write the function where we want to use. (See above example# 1.)

2 comments:

  1. Hey Guys, If you want to use this converter then you can easily convert your one file to other file;

    File to File Convertor

    ReplyDelete

Query to get Concurrent Program Data Template details

 SELECT  fcpt.user_concurrent_program_name       , fcp.concurrent_program_name       , fet.user_executable_name executable_name       , fe....