database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Q&A 2999 게시물 읽기
No. 2999
Error catching
작성자
정재익
작성일
2001-06-21 23:47
조회수
1,836

Submitted on: 04-12-2001

Description:

Used inside PL/pgSQL functions when you're not sure a variable_name will return an acceptable value. This catches NULL's and 0's and makes sure you do at least get a numerical value.

Code:

 

(CASE WHEN (var_name ISNULL or var_name = 0) THEN 0 ELSE var_name END)

 

i.e.

 

select display_value((CASE WHEN age ISNULL or age = 0) THEN 0 ELSE age END));

 

Justin Clift

justin@postgresql.org

[Top]
No.
제목
작성자
작성일
조회
3002eval() for PostgreSQL
정재익
2001-06-22
1959
3001Retrive comma separated PK attributes
정재익
2001-06-22
1906
3000Delete duplicate records in a table
정재익
2001-06-22
1909
2999Error catching
정재익
2001-06-21
1836
2998Operator --- IMP (>>> operator as logical implication)
정재익
2001-06-21
1804
2997Aggregate Function (2) -- first(), last()
정재익
2001-06-21
1733
2996Aggregate Function (1) -- comma-ify a list
정재익
2001-06-21
1868
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.017초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다