sql – 在strored过程中进行分页

前端之家收集整理的这篇文章主要介绍了sql – 在strored过程中进行分页前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想根据以下 link进行自定义分页

但我的存储过程在informix中:

所以我搜索等效的row_number()我发现这个solution

但是当我在我的程序中使用它时,我得到以下错误

sql error -944 Cann’t use “first”,”limit”,”skip” in this context !

如何使用informix规则重写上一个链接中的存储过程?

我的程序有多个工会是这样的:

create procedure get_inBox_page(p_emp_num smallint,p_task_code smallint,p_main_code smallint default 0,p_year smallint default 0,p_page int)
returning varchar(60) as v_page_view,varchar(60) as v_task_name,smallint as v_task_code,varchar(60) as v_sp_name,varchar(60) as v_db_name,varchar(60) as v_column_key,smallint as v_trans_serial,DATETIME YEAR TO FRACTION(3) as v_trans_date,varchar(60) as v_trans_desc,varchar(60) as v_emp_name,varchar(60) as v_values_key,smallint as v_old_state_serial,smallint as v_new_state_serial,smallint as v_main_code,smallint as v_year,varchar(60) as v_page_new,smallint as v_task_type,smallint as v_task_status,smallint as v_mail_maincode,smallint as v_mail_year,smallint as v_mail_number,smallint as v_trans_year,smallint as candidate_flag ;

Select  ......

UNION 

Select ......

UNION 

Select ......

解决方法

您不能使用FIRST,SKIP等,因为UNION集合中的每个SELECT语句都是自包含的.

也许您可以尝试创建一个封装SELECT … UNION … SELECT逻辑的VIEW,然后将FIRST / SKIP逻辑应用于该逻辑.

猜你在找的MsSQL相关文章