Answers for "sql pipeline example"

SQL
3

sql pipeline example

-- Return types
CREATE TYPE t_tf_row AS OBJECT (
  	id           NUMBER,
  	description  VARCHAR2(50)
);
CREATE TYPE t_tf_tab IS TABLE OF t_tf_row;
-- Build a pipelined table function.
CREATE OR REPLACE FUNCTION get_tab_ptf (p_rows IN NUMBER) 
	RETURN t_tf_tab PIPELINED AS
BEGIN
  	FOR i IN 1 .. p_rows LOOP
    	PIPE ROW(t_tf_row(i, 'Description for ' || i));   
  	END LOOP;
  	RETURN;
END;
-- Test it.
SELECT * FROM TABLE(get_tab_ptf(10)) ORDER BY id DESC;
Posted by: Guest on July-11-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language