scott@TOY10G> ho cat rowset.sql
CREATE TYPE rowset_o AS OBJECT ( col1 NUMBER,
col2 VARCHAR2(30));
/
CREATE TYPE rowset_t AS TABLE OF rowset_o;
/
CREATE OR REPLACE FUNCTION simple RETURN rowset_t AS
v_rowset rowset_t := rowset_t( );
BEGIN
v_rowset.EXTEND(3);
v_rowset(1) := rowset_o(1,'Value 1');
v_rowset(2) := rowset_o(2,'Value 2');
v_rowset(3) := rowset_o(3,'Value 3');
RETURN(v_rowset);
END;
/
scott@TOY10G> select * from table(simple);
COL1 COL2
---------- ------------------------------
1 Value 1
2 Value 2
3 Value 3
scott@TOY10G> select col2 from table(simple);
COL2
------------------------------
Value 1
Value 2
Value 3
Thursday, July 19, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment