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
운영게시판
최근게시물
DB2 Q&A 3091 게시물 읽기
No. 3091
DB2 PL을 오라클 PL로 바꾸기
작성자
양귀석(yangkuisuk)
작성일
2011-11-04 14:29
조회수
5,098

CREATE function ts_fmt(TS timestamp, fmt varchar(20)) returnsvarchar(50) return

with tmp (dd,mm,yyyy,hh,mi,ss,nnnnnn) as ( select substr( digits (day(TS)),9),

substr( digits (month(TS)),9) , rtrim(char(year(TS))) , substr( digits (hour(TS)),9),

substr( digits (minute(TS)),9), substr( digits (second(TS)),9), rtrim(char(microsecond(TS)))

from sysibm.sysdummy1 ) select case fmt when 'yyyymmddhhmiss'

then yyyy || mm || dd || hh || mi || ss when 'mm/dd/yyyy'

then mm || '/' || dd || '/' || yyyy when 'yyyy/dd/mm hh:mi:ss'

then yyyy || '/' || mm || '/' || dd || ' ' || hh || ':' || mi || ':' || ss when 'nnnnnn'

then nnnnnn else 'date format ' || coalesce(fmt,' ') || ' not recognized.' end from tmp;

 

 

 

 

CREATE FUNCTION FUNC_GET_FOLDERAUTHORITYID ( username varchar(100), treenodeid integer )

RETURNS VARCHAR(300)

LANGUAGE SQL

NOT DETERMINISTIC

EXTERNAL ACTION

READS SQL DATA

CALLED ON NULL INPUT

INHERIT SPECIAL REGISTERS

BEGIN ATOMIC

DECLARE strCodeValue varchar(300);--

SET strCodeValue = (username || TO_CHAR(treenodeid));--

return strCodeValue ;--

end;

 

이와 같은 DB2에서 쓰는 함수 정의가 있는데 오라클로 하면 어떻게 해야하나요?

도와주세면 감사하겠습니다.

[Top]
No.
제목
작성자
작성일
조회
3124vargraphic 사용시 길이제한
백승주
2011-11-15
4915
3123대용량(long varchar) 데이타 검색
백승주
2011-11-15
4982
3105특정 기간내의 연속된 일자를 구하고 싶습니다. [1]
곰두리
2011-11-09
4689
3091DB2 PL을 오라클 PL로 바꾸기
양귀석
2011-11-04
5098
3079DB2 AutoCommit에 관해서 문의
오장훈
2011-10-14
5277
3078db2에서 insert와 update를 동시에 할수있는방법 [2]
김영주
2011-10-12
5935
3075조건에서 OR 대신에 다른 방법은 없을까요? [1]
김영주
2011-09-23
5123
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.051초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다