http://forums.oracle.com/forums/thread.jspa?messageID=2820319� Wanted to use the pl/sql package in datatemplate ? Yes, we can use them in different ways, by using the oracle table function or Pipelined Table Functions. Pl/sql package will return the collection variable , which you can cast it as table in the query.. sample create type numset_t as table of number; / create function f1(x number) return numset_t pipelined is begin for i in 1..x loop pipe row(i); end loop; return; end; / select * from table(f1(3)); COLUMN_VALUE 1 2 3 In the datatemplate , you can just call the select * from table(f1(3)); Or even the parameter can be passed to the function, in which your entire logic can be written, which will return the collection variable. Datatemplate wil be more powerful , when used like this,