oracle function return resultset

Solutions on MaxInterview for oracle function return resultset by the best coders in the world

showing results for - "oracle function return resultset"
Magdalena
17 Jul 2016
1CREATE TYPE object_row_type as OBJECT (
2  object_type VARCHAR(18),
3  object_name VARCHAR(30)
4);
5
6CREATE TYPE object_table_type as TABLE OF object_row_type;
7
8CREATE OR REPLACE FUNCTION get_all_objects 
9  RETURN object_table_type PIPELINED AS
10BEGIN
11    FOR cur IN (SELECT * FROM all_objects)
12    LOOP
13      PIPE ROW(object_row_type(cur.object_type, cur.object_name));   
14    END LOOP; 
15    RETURN;
16END;
17
18SELECT * FROM TABLE(get_all_objects);
Eileen
04 Oct 2017
1CREATE OR REPLACE FUNCTION to_date_check_null(dateString IN VARCHAR2, 
2	dateFormat IN VARCHAR2) RETURN DATE IS
3BEGIN 
4    IF dateString IS NULL THEN
5        return NULL;
6    ELSE
7        return to_date(dateString, dateFormat);
8    END IF;
9END;