5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PostgreSQL 関数(ストアド)の作成

Last updated at Posted at 2015-11-30

前提

PostgreSQL 9.x

ソース

CREATE_FUNCTION.sql
DROP FUNCTION FUNCTION_NAME ();
CREATE FUNCTION FUNCTION_NAME () RETURNS BIGINT AS
'
BEGIN
  -- 処理
  return 1;
END;
'
LANGUAGE 'plpgsql';

-- 呼び出し時
-- select FUNCTION_NAME();

参考サイト

  1. [SQL] 13. ストアドプロシージャ (SQL 非標準) 1 | TECHSCORE(テックスコア)
  2. PostgreSQL 編19 - ストアドファンクション、function、PL/pgSQL、トリガー - SAK Streets
5
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?