PostgreSQL function里面调用function
来源:互联网 发布:java常用包和类 编辑:程序博客网 时间:2024/04/27 17:27
1. 调用无参无返回值的function
create or replace function func01()returns void as $$beginraise notice ' from func01(): hello PG';end ;$$language plpgsql;
create or replace function func02() returns void as $$beginperform func01();end;$$language plpgsql;
运行:
select func02();注意: from func01(): hello PGCONTEXT: SQL statement "SELECT func01()"在PERFORM的第3行的PL/pgSQL函数"func02"查询总耗时: 14 ms.检索到 1 行。
2. 调用无参有返回值的function
create or replace function func03()returns integer as $$beginreturn 1;end ;$$language plpgsql;create or replace function func02() returns void as $$beginperform func03();end;$$language plpgsql;
执行select fun02()的时候是没有任何返回值的,因为perform已经将结果丢弃。
将perform更改为select into:
create or replace function func02() returns void as $$declare n int;beginselect into n func03();raise notice 'n: %',n;end;$$language plpgsql;
执行:
select func02();注意: n: 1查询总耗时: 12 ms.检索到 1 行。
3. 有参有返回值
create or replace function func04(n int)returns integer as $$beginreturn n;end ;$$language plpgsql;create or replace function func02() returns void as $$declare n int;beginn=func04(4);raise notice 'n: %',n;end;$$language plpgsql;
执行:
select func02();注意: n: 4查询总耗时: 11 ms.检索到 1 行。
0 0
- PostgreSQL function里面调用function
- Postgresql function
- PostgreSQL window function
- PostgreSQL aggregate function customize
- PostgreSQL 之 Function NOTICE
- js怎么调用 var a=function (){ }()里面的方法
- Example: Create function in Postgresql
- PostgreSQL function返回多行
- PostgreSQL extend function - C example
- PostgreSQL之FUNCTION存储过程
- Function
- function
- function
- function $()
- Function
- function
- Function
- $(function(){...});
- hdu4217 Data Structure?
- 回调函数理解-以Fragment为例
- Java web基础总结十之—— jsp EL表达式
- Redhat6.2升级为Redhat6.3 (linux内核升级)
- Combination Sum
- PostgreSQL function里面调用function
- 利用ListView实现新闻客户端的新闻内容图文混排
- TL 栈,队列,优先队列用法
- UIPageControl与UIScrollView的联合使用
- 给老师的建议只允许输入汉字,否则卡死一片~~
- Project Euler:Problem 16 Power digit sum
- Fedora10 配置使用root用户登录
- AVS+标准应用现状
- 四月,五月学习小结