Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. create or replace type my_table_info_function as object(
  2. ORDER_ID VARCHAR2(40),
  3. OPER_KEY NUMBER,
  4. STEP_KEY NUMBER)
  5.  
  6. CREATE OR REPLACE TYPE MY_TYPE as table of my_table_info
  7.  
  8. create or replace function MY_FUNCTION(vi_col1 table.col1%type,
  9. vi_col2 table.col2%type,
  10. vi_col3 table.col3%type)
  11. return MY_TYPE as
  12.  
  13. V_RESULTS MY_TYPE :=MY_TYPE();
  14.  
  15. V_RESULTS.EXTEND;
  16. V_RESULTS(V_RESULTS.LAST):=MY_TYPE(vi_col1,vi_col2,vi_col3);
  17.  
  18. return V_RESULTS;
  19.  
  20. Now in your query, you can directly select column from type as below;
  21.  
  22. select col1,col2,col3 from my_table_info_function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement