For Postgresql Functions (Stored Procedures):
I want a stored procedure to be able to return different table structures based on a parameter that is passed. Rough Example:
CREATE OR REPLACE FUNCTION getMyinfo(emp_id varchar, inc_status)
RETURNS TABLE [don't know how to set this...???]
AS
$$
BEGIN
if inc_status = false
then
return select fname, lname, emp_age from emp_data
where id = emp_id;
else
return select fname, lname, emp_age, rev_code, m_stat
where id = emp_id;
end if;
END
$$