adspace
How can a function retun more than one value in oracle with proper example?
Answer Posted / Shalini Pathak
In Oracle PL/SQL, a function cannot return multiple values directly. However, you can use collections (such as arrays or tables) to return multiple values. Here's an example of a table-valued function that returns a table of employee names:
CREATE OR REPLACE TYPE employees_table AS TABLE OF VARCHAR2(30);
CREATE OR REPLACE FUNCTION get_employees RETURN employees_table IS
v_employees employees_table;
BEGIN
SELECT employee_name BULK COLLECT INTO v_employees FROM employees;
RETURN v_employees;
END;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the best sql course?
what are the advantages of sql ? : Sql dba
how to use regular expression in pattern match conditions? : Sql dba
Can delete statement be rollbacked?
Is inner join faster than left join?
Does group by remove duplicates?
What is the current version of postgresql?
what are all the common sql function? : Sql dba
Is primary key always clustered index?
What is your daily office routine?
what is sql server agent? : Sql dba
Can we use distinct and group by together?
If a cursor is open, how can we find in a pl/sql block?
Can we rollback truncate?
Do we need to rebuild index after truncate?