blogger

    blogger
  • hot log

  • comment

    twitter

    • 12.10.xC6出来时候碰到"Could not determine encryption mode from page zero",竟果然是BUG!http://www-01.ibm.com/support/docview.wss?rs=630&uid=swg21973408

      2015-12-21 20:15

    • 空间已经转移到新加坡,希望会好一些。

      2015-11-16 14:34

    • 增加新域名liaosnet.cc,与liaosnet.com同指向。

      2015-10-09 15:25

    • 空间迁移到香港。或许速度会快一点。。

      2014-02-13 20:10

    • 解决个问题:NBU配置Storage时的目录在系统分区上,导致备份失败,最终原因是目录在系统分区上时,需要在 This directory can exist on the root file system or system disk. 这个选项前打上勾。

      2012-09-26 22:21

    • More»

    blog sort

    links

    record

    banner

    GBase 8t使用unix_timestamp()函数

    暗夜星空's Memory from Apr 25 , 2017 at 22:17 PM , under Category:INFORMIX
    从mysql迁移到GBase 8t数据库时,原有unix_timestamp()函数在GBase 8t中不可用,因此需要自己创建相应的函数,可以使用C或者JAVA创建自定义例程,也可以使用存储过程。以下以存储过程方式创建。
    create procedure UNIX_TIMESTAMP(datestr datetime year to fraction(5)) 
    returning  int;
    
      define srcdate datetime year to fraction(5);
      define rc_char varchar(30);
      define rc int;
    
      let srcdate = datetime(1970-01-01 00:00:00.00000)  year to fraction(5) ;
      let rc_char = datestr - srcdate;
      -- rc_char 17281 13:07:11.00000
      let rc = (substr(rc_char,1,9)*86400 + substr(rc_char,17,2)*1 + substr(rc_char,14,2)*60 + substr(rc_char,11,2)*3600)::integer;
      let rc = rc - 8*3600;
    
      return rc;
    end procedure ;
    
    create procedure UNIX_TIMESTAMP(datestr varchar(30)) 
    returning  int;
    
      define srcdate datetime year to second;
      define tmpdate datetime year to second;
      define rc_char varchar(30);
      define rc int;
    
      let srcdate = datetime(1970-01-01 00:00:00)  year to second ;
      let tmpdate = to_date(datestr,'%Y-%m-%d %H:%M:%S');
      let rc_char = tmpdate - srcdate;
      -- rc_char 17281 13:07:11.00000
      let rc = (substr(rc_char,1,9)*86400 + substr(rc_char,17,2)*1 + substr(rc_char,14,2)*60 + substr(rc_char,11,2)*3600)::integer;
      let rc = rc - 8*3600;
    
      return rc;
    end procedure ;

    Post a comment:

    Your email address will not be published. Required fields are marked﹡