.net C # calling oracle stored procedure variable use pagination

1 oracle stored procedure creates

the Create  or  the replace  Procedure p_procname (i_id   in  Integer , 
                                                   i_keyword   in  VARCHAR2 , - where the parameters do not need to write the character length 
                                                   i_pagenum   in  Integer , - in parameters are input represents the way, out on behalf of parameter is the Output. 
                                                   i_pagesize in  Integer , 
                                                   o_ecur OUT SYS_REFCURSOR) AS - here is the key, oracle is to use the cursor to store the query results 
  v_begin Integer ; - need to write here variable length character
  V_END that    Integer ; - must take semicolon;

 the begin 
- Oracle, there are two common methods assign a name change: = 'myname'; one is using INTO  
  SELECT ((i_pagenum -  . 1 ) * i_pagesize +  . 1 ), (i_pagenum * i_pagesize)
     INTO v_begin, V_END that
     from Dual; - Dual is a virtual table, oracle can not directly select, must be used with form. 

  Open o_ecur for - the cursor is opened, receives the query result set
  
     SELECT ID, T
       from ( SELECT ID, 
                   ROW_NUMBER () over ( Order  bycredate desc ) the n-, - windowing function, and the use of SQL SERVER the same.
                   COUNT ( . 1 ) over () T - a windowing function, and usage of the same SQL SERVER. 
              from TableName
              WHERE ID = i_id
                and (name like  ' % '  || i_keyword ||  ' % ' ) - Oracle splice string field using ||  
            ) T 
     WHERE n- BETWEEN v_begin and V_END that; 

End p_procname;
            

 

Guess you like

Origin www.cnblogs.com/BinBinGo/p/11605549.html