This memory process successfully implements rantrifier conversion statistics
The salary data is a vertical table, that is, the salary of an employee corresponds to a number of salary columns.
Create or Replace Procedure PRC_RS_GZNDBB (p_table in varcha2) IS / * ===================================== ============================================================================================================================================================================================================= ============ name: prc_rs_gzndbb (procedure) parameters: incoming: p_table varchar2 call: PRC_YD_SHTZTJYH returns: function: Calculate staff payroll annual report returns: the statistical results of the table insert p_table: writing Time: 2005-2-21 Modify: Modification: Modification: ================================= ============================================================================================================================================================================================================= ========================1. - Column name v_sql varchar2 (1000); - Define Take the salary column Cursor CURSOR CUR_LMMC IS SELECT DISTINCT LMMC from FROM TMP_GZTJLSB; Begin - Defined Dynamic SQL V_SQL: = 'SELECT RYDM, XM'; - Traverse the salary column and spells into inserted SQL for cur_lmmc_rec in cur_lmmc_rc.lmmc; v_sql: = v_sql || ',' || 'SUM (Decode (LMMC' || ',' '' || V_LMMC || '' ', JE))' || '|| V_LMMC;