plsql - Oracle nested tables and column names -
I want to do the following in Oracle 10g (this is a hypothetical example to show the concepts, not the real code)
create table order (order_id NUMBER); Insert table order values (1); Insert table order values (2); Insert table order values (3); TYPE is a NUMBER_ARRAY_T NUMBER table; Process VALIDATE_ORDER_IDS (i_orders in NUMBER_ARRAY_T, out of o_output SYS_REFCURSOR) takes the open o_output to select ??? From table (i_orders) where ??? No (choose order_id from order); END VALIDATE_ORDER_IDS;
The stored procedure can be said with an array containing (1,2) and we were expected to return 3 as a result
So, the question Is that where there is a column name to specify any where ??? When a nested table is used as a table, will the above selection statement work?
After the
the keyword you are looking for is column_value
. With your settings:
SQL & gt; Type NUMBER_ARRAY_T or republish table NUMBER; 2 / type sql and gt; Create or change process validate_order_ids (number_array_t in i_orders, 2 SYS_REFCURSOR out o_output) Select 3 to 5 for COLUMN_VALUE 6 start 4 open o_output from table (i_orders) IS7 ou COLUMN_VALUE (select ORDER_ID by command); 8 END validate_order_ids; 9 / Process created
To process you will simply call:
SQL & gt; Variable x REFCURSOR SQL & gt; Exec validate_order_id (number_array_t (1,5),: x); PROUDUR PLL / SQL TERMINUS ACCESS Hundreds of SQL & gt; Print x COLUMN_VALUE ------------ 5
Comments
Post a Comment