19.7 ADD_ORDER_BYプロシージャ
このプロシージャは、ORDER BYコレクションにORDER BY式を追加します。
構文
PROCEDURE ADD_ORDER_BY (
    p_order_bys         IN OUT NOCOPY t_order_bys,
    p_position          IN            PLS_INTEGER,
    p_direction         IN            t_order_direction default c_order_asc,
    p_order_nulls       IN            t_order_nulls     DEFAULT NULL );
procedure add_order_by (
    p_order_bys         IN OUT nocopy t_order_bys,
    p_column_name       IN            t_column_name,
    p_direction         IN            t_order_direction default c_order_asc,
    p_order_nulls       IN            t_order_nulls     DEFAULT NULL );パラメータ
表19-4 ADD_ORDER_BYプロシージャのパラメータ
| パラメータ | 説明 | 
|---|---|
| 
 | ORDER BYコレクション。 | 
| 
 | 指定されたデータソースの列を位置で参照します。 | 
| 
 | 指定されたデータ・ソースの列名または別名を参照します。 | 
| 
 | 列を昇順または降順でソートするかどうかを定義します。有効な値は | 
| 
 | NULLデータを最下位または最上位にソートするかどうかを定義します。有効な値は | 
例
declare
    l_order_bys   apex_exec.t_order_bys;
    l_context     apex_exec.t_context;
begin
    apex_exec.add_order_by(
        p_order_bys     => l_order_bys,
        p_column_name   => 'ENAME',
        p_direction     => apex_exec.c_order_asc );
   l_context := apex_exec.open_web_source_query(
       p_module_static_id => '{web source module static ID}',
       p_order_bys        => l_order_bys,
       p_max_rows         => 1000 );
       while apex_exec.next_row( l_context ) loop
          -- process rows here ...
       end loop;
   apex_exec.close( l_context );
exception
    when others then
        apex_exec.close( l_context );
raise;
end;親トピック: APEX_EXEC