文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Extending the Database: SQL Functions

Extending the Database: SQL Functions

时间:2010-01-23  来源:admin126com

Extending the Database: SQL Functions

  • SQL functions are group of SQL statements which return the last statement, which should be a SELECT one.
  • Example:
test=> CREATE FUNCTION name_len(employees)
test-> RETURNS int4
test-> AS
test-> 'SELECT
test'> CASE WHEN $1.last_name = null THEN 0 ELSE
char_length($1.last_name) END
test'> + 1 +
test'> CASE WHEN $1.last_name = null THEN 0 ELSE
char_length($1.last_name) END
test'> AS name_length'
test-> LANGUAGE 'sql' \g
CREATE
  • Now you can use this function inside your queries:
test=> SELECT name_len(employees)
test-> FROM employees \g
相关阅读 更多 +
排行榜 更多 +
模拟驾驶消防车无限金币

模拟驾驶消防车无限金币

模拟经营 下载
我的可爱宠物屋无限金币

我的可爱宠物屋无限金币

模拟经营 下载
偷吃点心游戏免广告

偷吃点心游戏免广告

模拟经营 下载