戻る

VIEW 作成スクリプト

0001: #! /bin/bash
0002: #-----------------------------------------------------------#
0003: # CreateViewVJOIN_SGFO.sh
0004: # =======================
0005: #
0006: # VIEW : VJOIN_SGFO 作成
0007: #
0008: # CreateViewVJOIN_SGFO.sh { <option> }
0009: # <option> : -d               View  を削除する
0010: #            -r               View を再作成する
0011: #                             既定値は新規作成
0012: #            encode=UTF8      CHARACTER SET を UTF8 にする
0013: #                             既定値は EUCJ_0208
0014: #            dbpath=<path>    <path> の DBFILE を使う
0015: #                             既定値は /DB/birds/birds.fdb
0016: #
0017: # $Id: CreateViewVJOIN_SGFO.sh,v 1.7  ##########  $
0018: # ------------------------------------------------------------ #
0019: encode="EUCJ_0208"
0020: dbpath="localhost:/DB/birds/birds.fdb"
0021: while [ "${1}" != "" ]; do
0022:     [ "${1:0:1}" == "-" ]       && param=${1}
0023:     [ "${1:0:7}" == "encode=" ] && encode=${1:7}
0024:     [ "${1:0:7}" == "dbpath=" ] && dbpath=${1:7}
0025:     shift
0026: done
0027: 
0028: if [ "${param}" == "-d" ] || [ "${param}" == "-r" ]; then
0029:     echo '**** DROP VJOIN_SGFO ****'
0030:     isql<<EOF
0031: CONNECT "${dbpath}" USER "SYSDBA" PASSWORD "********";
0032: DROP VIEW VJOIN_SGFO;
0033: COMMIT;
0034: QUIT;
0035: EOF
0036:     [ "${param}" == "-d" ] && exit
0037: fi
0038: 
0039: echo '**** CREATE VJOIN_SGFO ****'
0040: isql <<EOF
0041: SET NAMES ${encode};
0042: CONNECT "${dbpath}" USER "SYSDBA" PASSWORD "********";
0043: /************************************************************/
0044: /* VIEW : VJOIN_SGFO                                        */
0045: /*                                                          */
0046: /* テーブル SPECIES, GENUS, FANILY, ORDERTAB                */
0047: /* を JOIN して読み取るための VIEW                          */
0048: /*                                                          */
0049: /************************************************************/
0050: CREATE VIEW VJOIN_SGFO(
0051:     OSEQNO,
0052:     ORDERNAME,
0053:     ORDERJPN,
0054:     FSEQNO,
0055:     FAMILYNAME,
0056:     FAMILYJPN,
0057:     GSEQNO,
0058:     GENUSNAME,
0059:     GENUSJPN,
0060:     SSEQNO,
0061:     SPECIESNAME,
0062:     SPECIESJPN,
0063:     SPECIESENG,
0064:     SPECIESENGCAP
0065: )
0066: AS
0067:   SELECT
0068:     ORDERTAB.SEQNO,
0069:     ORDERTAB.ORDERNAME,
0070:     ORDERTAB.ORDERJPN,
0071:     FAMILY.SEQNO,
0072:     FAMILY.FAMILYNAME,
0073:     FAMILY.FAMILYJPN,
0074:     GENUS.SEQNO,
0075:     GENUS.GENUSNAME,
0076:     GENUS.GENUSJPN,
0077:     SPECIES.SEQNO,
0078:     SPECIES.SPECIESNAME,
0079:     SPECIES.SPECIESJPN,
0080:     SPECIES.SPECIESENG,
0081:     SPECIES.SPECIESENGCAP
0082:   FROM
0083:     ORDERTAB,
0084:     FAMILY,
0085:     GENUS,
0086:     SPECIES
0087:   WHERE
0088:     GENUS.GENUSNAME=SPECIES.GENUSNAME AND
0089:     FAMILY.FAMILYNAME=GENUS.FAMILYNAME AND
0090:     ORDERTAB.ORDERNAME=FAMILY.ORDERNAME;
0091: COMMIT;  
0092: GRANT ALL ON VJOIN_SGFO TO PUBLIC;
0093: COMMIT;
0094: QUIT;
0095: exit

この HTML を検査する。( XHTML 1.0 Strict で書かれています )
Another HTML Lint Gateway ( Mirrored by htmllint.oosato.org )