自定函数

1、查询函数:

 select prosrc from pg_proc where proname='test'

参数说明 : test 为函数名。

2、删除函数:

  drop function test(anyelement,anyelement,numeric)

参数说明 : test 为函数名。

3、定义数据库函数: 

  create or replace function calculate_speed(end_time anyelement,begin_time anyelement,length numeric) RETURNS numeric  as
$$
declare
total_second numeric;
begin
select extract(epoch from((end_time::timestamp - begin_time)))/3.6 into total_second;
return round(length::numeric/total_second::numeric,3);
end;
$$ LANGUAGE plpgsql;

参数说明:calculate_speed代表自定义函数名称     anyelement numeric参数类型   begin end函数体的开始和结束

最新文章

  1. Java 第16章 封装
  2. 密钥文件snk
  3. oracle一点记录
  4. Oracle事务之一:锁和隔离
  5. for循环与for in循环
  6. Word中批量替换软回车
  7. 查询制定行数的数据(2)对了,mysql不能用top关键字
  8. C#中A a=new B()的意义
  9. Project Euler problem 63
  10. DataTable复制自身行
  11. Cocos2d-X 动作展示《一》
  12. Ext JS学习第二天 我们所熟悉的javascript(一)
  13. leetcode[149]Max Points on a Line
  14. could not resolve host: github.com 问题解决办法
  15. 1129: 零起点学算法36——3n+1问题
  16. 求前n个素数(C++)
  17. rabbitmq 日志存储路径
  18. WordPress主题开发:按分类调用文章
  19. [原]Django(1)----Django-setting中的STATIC_URL 和STATIC_ROOT 和STATICFILES_DIRS 的区别
  20. P4592 [TJOI2018]异或

热门文章

  1. 2019 ICPC 南京网络赛 H-Holy Grail
  2. python 中关于无法导入自己写的类。解决方法
  3. STM32 TIM高级定时器死区时间的计算
  4. ubuntu安装java方法
  5. ZOOM火速收购加密公司Kaybase 能否补齐安全短板?
  6. HBase 安装snappy压缩软件以及相关编码配置
  7. HTTP Status完整枚举
  8. k8s big-ip control 安装使用
  9. python之Python内置函数一览表
  10. 用了这么多年MySql,这些好习惯你用过哪些