zoukankan      html  css  js  c++  java
  • 无名

    reate or replace procedure SP_PageQuery
    (p_StrQuery in varchar2,
    p_CurPage in out integer,
    p_PageSize in out Integer,
    p_TotalRecords out integer,
    p_TotalPages out integer,
    v_cur out SYS_REFCURSOR
    )
    is
    v_strsql varchar2(4000):='';
    v_FirstRecord  integer;
    v_LastRecord   integer;
    begin
    if( p_StrQuery is not null) then
    v_strsql:= 'select count(*) from ( '|| p_StrQuery ||') where 1=1';
       EXECUTE IMMEDIATE v_strsql  into p_TotalRecords ;
    end if;
    if(p_PageSize<0) then
    p_PageSize:=0;
    end if;
    if(mod(p_TotalRecords,p_PageSize)=0) then
    p_TotalPages := p_TotalRecords/p_PageSize;
    else
    p_TotalPages := p_TotalRecords/P_PageSize;
    end if;
    if(p_CurPage<1) then
    p_CurPage :=1;
    end if;
    if(p_CurPage>p_TotalPages) then
    p_CurPage :=p_TotalPages;
    end if;
    v_FirstRecord :=(p_CurPage - 1) * p_pageSize + 1;
    v_LastRecord  := p_CurPage*p_PageSize ;
    v_strsql:=' with t1 as (select rownum as xh,a.* from ('
    || p_StrQuery ||' )  a) select t1.* from t1  where xh >= '
    || v_FirstRecord ||
    ' and xh<= '
    ||v_LastRecord;
    open v_cur for v_strsql;
    end SP_PageQuery;

    一:

    SELECT CASE WHEN CONVERT(varchar(10),lastpasstime,120)='2009-12-08' THEN ''
     ELSE CONVERT(VARCHAR(20),lastpasstime,120) END a,* FROM users

    二:select replace (CONVERT(VARCHAR(20),lastpasstime,120),‘lastpasstime’,'') from users

  • 相关阅读:
    bzoj4476: [Jsoi2015]送礼物
    牛客练习赛42 E.热爆了
    bzoj3561: DZY Loves Math VI
    bzoj3560: DZY Loves Math V
    bzoj3512: DZY Loves Math IV
    bzoj3481: DZY Loves Math III
    使用WebUploader本地生成缩略图
    centos 7 安装JDK1.8
    APK反编译
    centos 7 配置pytorch运行环境
  • 原文地址:https://www.cnblogs.com/umlzhang/p/1837636.html
Copyright © 2011-2022 走看看