Skip to content

Instantly share code, notes, and snippets.

Avatar

陳瀛洲 ChenYingChou

View GitHub Profile
@ChenYingChou
ChenYingChou / pgCursors.js
Last active May 2, 2020
Node JS : Make pg-cursor easier to use
View pgCursors.js
// vim: set ts=4 sw=4 sts=4 et cindent:
const pg = require('pg')
const Pool = pg.Pool
const Cursor = require('pg-cursor')
//@ts-check
class PgCursors {
/**
* @param {pg.Pool} db
View gist:4696872
SELECT
DISTINCT DECODE(CARNO, NULL, 'X','Y') P -- 是否有車號, 'X':無, 'Y':有
, RQT_NO RNO -- 叫車序號
, RQTSEQ_NO RSNO -- 叫車序號支號
, DEP -- 通關類別
, (SELECT SUBSTR(DEP_NAME,1,2) FROM ORG WHERE ORG.DEP_ID = T.DEP_ID) DEP_ID -- 部門名稱前2碼
, RQT_BY
, DECODE(BOX_NOCAR,NULL, CARNO,CARNO||','||BOX_NOCAR) CARNO
, NVL((SELECT CEMP_NAME FROM EMPLOYEE WHERE EMP_CODE= T.DRIVER),DRIVER)DR
, CASE WHEN RESERVED_FLAG = 'Y' THEN -- 若是專車