やはり、内製がいいんじゃないかと、内製を勧めている本をよんで改めて思う。
内製押しの本なので、良いこと書いてあるに決まっているのだが、こちらが正解ではと思う。
開発・改良の切り札 システム内製を極める
Oracle Application Express Notes | Apps development Notes | Google Cloud Platform | Python | apps test | Cool Beans | English | Books
// as is | |
apex.jQuery("span[data-style]").each( | |
function() | |
{ | |
apex.jQuery(this). | |
parent().attr( 'style' | |
, apex.jQuery(this).attr('data-style') | |
); | |
} | |
// to be | |
apex.jQuery("span[data-style]").each( | |
function() | |
{ | |
apex.jQuery(this). | |
closest('td').attr( 'style' | |
, apex.jQuery(this).attr('data-style') | |
); | |
} |
//同じスクリーンに表示させる | |
window.location.href = 'http://XXXXXXX/XXXXXX/XXXXX/'+ document.getElementById('P13_X').value+'.pdf'; | |
//新しいWINDOWに表示させる | |
window.open('http://XXXXXXX/XXXXXX/XXXXX/'+ document.getElementById('P13_X').value+'.pdf'); | |
select ID | |
, USERNAME | |
, FOODS | |
, T_GET_NAME(FOODS) FOODS_NAME | |
from T_QA_SAMPLE; | |
ID USERNAME FOODS FOODS_NAME | |
-------------------------------------------------------------------------- | |
41 APEX 1:2:4:5:6 Fried Rice, Hamburger, Ramen, Steak, Sushi | |
1 Toshi 1:2:5:6 Fried Rice, Ramen, Steak, Sushi | |
21 TEST 1:3:4 Hamburger, Pasta, Sushi | |
22 TEST2 5:6 Fried Rice, Steak |
create or replace function "T_GET_NAME" | |
(p_text in VARCHAR2) | |
return VARCHAR2 | |
is | |
l_codetext varchar2(2000); | |
BEGIN | |
SELECT LISTAGG(L.LOOKUP_NAME,', ') WITHIN GROUP (order by null) codetext | |
INTO l_codetext | |
FROM | |
--- INPUT された p_text を1列テーブルに変換し、テーブルSとする | |
(WITH TEMP AS (SELECT p_text IN_TEXT FROM dual) | |
SELECT trim(regexp_substr(IN_TEXT, '[^:]+', 1, LEVEL)) ID_LIST | |
FROM TEMP | |
CONNECT BY instr(IN_TEXT, ':', 1, LEVEL - 1) > 0) S | |
--- 名称マスタ を テーブルL とする | |
, T_LOOKUPS L | |
WHERE S.ID_LIST = L.G_SEQ; | |
return l_codetext; | |
END; |
SELECT trim(regexp_substr(<文字列>, '[^<区切文字>]+', 1, LEVEL)) ID_LIST | |
FROM DUAL | |
CONNECT BY instr(<文字列>, <区切文字>, 1, LEVEL - 1) > 0; | |
-- この場合は、文字列が 1:2:5 で、区切り文字が: | |
SELECT trim(regexp_substr('1:2:5', '[^:]+', 1, LEVEL)) ID_LIST | |
FROM DUAL | |
CONNECT BY instr('1:2:5', ':', 1, LEVEL - 1) > 0; |
ID_LIST | |
-------- | |
1 | |
2 | |
5 |
-- 追記 IEのエラー回避 void(0); を最後つける | |
javascript:apex.navigation.popup({"url":'f?p=&APP_ID.:7<ページ番号>:&SESSION.::&DEBUG.:::',"name":"winLov","width":350,"height":400});void(0); | |
-- 同一アプリ無いのページ7をPOPUPさせる | |
-- 普通バージョン | |
javascript:window.open('f?p=&APP_ID.:7<ページ番号>:&SESSION.::&DEBUG.:::','popup1','width=640,height=480,top=0,left=0'); | |
-- oracle のAPIを使うバージョン | |
javascript:apex.navigation.popup({"url":'f?p=&APP_ID.:7<ページ番号>:&SESSION.::&DEBUG.:::',"name":"winLov","width":350,"height":400}); | |
-- | |
-- 変数も渡せる :これは、アプリ944ページ1にITEMを渡すサンプル | |
javascript:apex.navigation.popup({"url":'f?p=944:1:&SESSION.::&DEBUG.::P1_ITEM:#ITEM#',"name":"winLov","width":700,"height":200}); |
Change password for <span style="color: red; font-size: large;"><b>&APP_USER.</b></span> |
select "FARE", --背景色を変えたいカラム名 | |
--セルの書式用のダミーカラムを作成 | |
CASE WHEN "FARE" < 30 THEN 'data-style = "background-color:#00CC33"' | |
WHEN "FARE" < 50 THEN 'data-style = "background-color:#FFFF33"' | |
WHEN "FARE" < 70 THEN 'data-style = "background-color:#FFCCFF"' | |
WHEN "FARE" >= 70 THEN 'data-style = "background-color:#FF0000;font-weight:bold;color:#FFFFFF"' | |
ELSE 'data-style = "background-color:#FFFFFF"' | |
END "FARE_COLOR" -- ダミーカラム名 | |
from "#OWNER#"."TITANIC" |
<span #FARE_COLOR#>#FARE#</span> |
apex.jQuery("span[data-style]").each( | |
function() | |
{ | |
apex.jQuery(this). | |
parent().attr( 'style' | |
, apex.jQuery(this).attr('data-style') | |
); | |
} | |
); |
SELECT * | |
FROM | |
( select a.* | |
, ROW_NUMBER() OVER(PARTITION BY ITEM ORDER BY COUNT DESC, YYYYMM DESC) FLAG | |
from | |
( select <ITEM> ITEM | |
, to_char(<SALESDATE>,'YYYYMM') YYYYMM | |
, count(1) COUNT | |
from <SALES> | |
group by <ITEM> | |
, to_char(<SALESDATE>,'YYYYMM') | |
) a | |
) | |
WHERE FLAG = 1 | |
; |
-- テーブル情報の表示 | |
testdb=> \d -- teble 一覧表示 | |
リレーションの一覧 | |
スキーマ | 名前 | 型 | 所有者 | |
----------+------------+----------+-------- | |
public | department | テーブル | toshi | |
(1 行) | |
testdb=> \d department -- tableのカラム名/型を表示 | |
テーブル "public.department" | |
列 | 型 | 修飾語 | |
--------+---------------+---------- | |
id | integer | not null | |
dept | character(50) | not null | |
emp_id | integer | not null | |
インデックス: | |
"department_pkey" PRIMARY KEY, btree (id) | |
-- 接続終了 | |
testdb=> \q | |
-- 設定ファイルの確認 | |
testdb=> SHOW config_file | |
# POSTGRESQLのインストールからクライアント接続するまで(ubuntu 16.4 LTS on VIRTUALBOX with MAC) | |
#1# INSTALL | |
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' | |
$ wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add - | |
$ sudo apt-get update | |
$ sudo apt-get install postgresql postgresql-contrib | |
#2# START | |
$ sudo /etc/init.d/postgresql start | |
$ sudo /etc/init.d/postgresql status | |
#3# SET initial password for postgres | |
$ sudo passwd postgres | |
Enter new UNIX password: | |
Retype new UNIX password: | |
passwd: password updated successfully | |
#4# login as postgres and create DB and user | |
$ su - postgres ## userをpostgresに変更する | |
$ createdb <dbname> ## dbを作成する | |
$ psql <dbname> ## dbにpostgresでログインする | |
psql (9.5.3) | |
"help" でヘルプを表示します. | |
<dbname>=# create role <username> with login; ## <username>でログインできるようにする | |
CREATE ROLE | |
<dbname>=# \q | |
$ su - <username> ## userを変更する | |
$ psql <dbname> ## dbに<username>でログインする | |
psql (9.5.3) | |
"help" でヘルプを表示します. | |
<dbname>=> | |
#5# Allow to access from client | |
$ vi /etc/postgresql/9.5/main/postgresql.conf ## postgresql.conf のセッティングを変更する | |
##以下抜粋## | |
#------------------------------------------------------------------------------ | |
# CONNECTIONS AND AUTHENTICATION | |
#------------------------------------------------------------------------------ | |
# - Connection Settings - | |
listen_addresses = '*' ##初期は、クライアントからの接続を許可していないので | |
##'*’に変更する | |
##編集終了## | |
$ /etc/init.d/postgresql restart ## リスタートする | |
$ vi /etc/postgresql/9.5/main/pg_hba.conf ## pg_hba.conf のセッティングを変更する | |
##以下抜粋## | |
# TYPE DATABASE USER ADDRESS METHOD | |
# IPv4 local connections: | |
host all all all trust | |
## これは、ADDRESSにALLをセット、MethodにTrustをセット。これはどの端末からでも | |
## どのDBへの接続も許可している。 | |
##編集終了## | |
$ /etc/init.d/postgresql restart ## リスタートする | |
## このあとクライアントソフトからテストして確認する ## |
#1# bash の種類を確認 | |
$ which bash | |
/bin/bash | |
#この結果をスクリプトの一行目に表示する | |
#!/bin/bash | |
#2# フォルダの変更 | |
$ cd .. #一つ上のフォルダへ | |
#3# フォルダの中身を表示 | |
$ ls #ただ表示するだけ | |
bin drafts pages tmp | |
$ ls -a #.始まりも表示 隠しファイルも表示 | |
. .. .git bin drafts pages tmp | |
$ ls -l #リスト表示 | |
total 8 | |
drwxr-xr-x 5 Toshi_Admin staff 170 Jun 14 22:39 bin | |
drwxr-xr-x 3 Toshi_Admin staff 102 Jun 14 22:17 drafts | |
drwxr-xr-x 9 Toshi_Admin staff 306 Jun 14 22:15 pages | |
-rw-r--r-- 1 Toshi_Admin staff 357 Jun 16 22:22 tmp | |
$ ls -la #リストと隠しファイル表示を同時に実行 | |
total 8 | |
drwxr-xr-x 7 Toshi_Admin staff 238 Jun 16 22:22 . | |
drwx------+ 7 Toshi_Admin staff 238 Jun 13 22:15 .. | |
drwxr-xr-x 12 Toshi_Admin staff 408 Jun 16 22:24 .git | |
drwxr-xr-x 5 Toshi_Admin staff 170 Jun 14 22:39 bin | |
drwxr-xr-x 3 Toshi_Admin staff 102 Jun 14 22:17 drafts | |
drwxr-xr-x 9 Toshi_Admin staff 306 Jun 14 22:15 pages | |
-rw-r--r-- 1 Toshi_Admin staff 357 Jun 16 22:22 tmp | |
#4#ファイル、フォルダの削除 | |
$ rm xxxxxx.conf #ファイルの削除 | |
$ rm -r pages # フォルダの削除 | |
#5#ファイルのコピー | |
$ cp xxxxxx.txt xxxx123.txt #ファイル単体のコピー | |
$ cp -r YYYYY ZZZZZ # フォルダーのコピー | |
#6# ディレクトリを作成 | |
$ mkdir xxxxx #xxxxx ディレクトリをカレントディレクトリに作成 |
################################################################### | |
# Oracle HTTP Server mod_ossl configuration file: ssl.conf # | |
################################################################### | |
# OHS Listen Port | |
Listen 4443 | |
<IfModule ossl_module> | |
## | |
## SSL Global Context | |
## | |
## All SSL configuration in this context applies both to | |
## the main server and all SSL-enabled virtual hosts. | |
## | |
# | |
# Some MIME-types for downloading Certificates and CRLs | |
AddType application/x-x509-ca-cert .crt | |
AddType application/x-pkcs7-crl .crl | |
# Pass Phrase Dialog: | |
# Configure the pass phrase gathering process. | |
# The filtering dialog program (`builtin' is a internal | |
# terminal dialog) has to provide the pass phrase on stdout. | |
SSLPassPhraseDialog builtin | |
# Inter-Process Session Cache: | |
# Configure the SSL Session Cache: First the mechanism | |
# to use and second the expiring timeout (in seconds). | |
SSLSessionCache "shmcb:${ORACLE_INSTANCE}/diagnostics/logs/${COMPONENT_TYPE}/${COMPONENT_NAME}/ssl_scache(512000)" | |
SSLSessionCacheTimeout 300 | |
# Semaphore: | |
# Configure the path to the mutual exclusion semaphore the | |
# SSL engine uses internally for inter-process synchronization. | |
<IfModule mpm_winnt_module> | |
SSLMutex "none" | |
</IfModule> | |
<IfModule !mpm_winnt_module> | |
SSLMutex pthread | |
</IfModule> | |
## | |
## SSL Virtual Host Context | |
## | |
<VirtualHost *:4443> | |
<IfModule ossl_module> | |
# SSL Engine Switch: | |
# Enable/Disable SSL for this virtual host. | |
SSLEngine on | |
# Client Authentication (Type): | |
# Client certificate verification type and depth. Types are | |
# none, optional and require. | |
SSLVerifyClient None | |
# SSL Protocol Support: | |
# List the supported protocols. | |
SSLProtocol nzos_Version_1_0 nzos_Version_3_0 | |
# SSL Cipher Suite: | |
# List the ciphers that the client is permitted to negotiate. | |
SSLCipherSuite SSL_RSA_WITH_RC4_128_MD5,SSL_RSA_WITH_RC4_128_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA | |
# SSL Certificate Revocation List Check | |
# Valid values are On and Off | |
SSLCRLCheck Off | |
#Path to the wallet | |
#SSLWallet "${ORACLE_INSTANCE}/config/${COMPONENT_TYPE}/${COMPONENT_NAME}/keystores/default" | |
SSLWallet file:/u01/app/oracle/product/ohs_apxd1/owm/wallets/oraapxd1 | |
<FilesMatch "\.(cgi|shtml|phtml|php)$"> | |
SSLOptions +StdEnvVars | |
</FilesMatch> | |
<Directory "${ORACLE_INSTANCE}/config/${COMPONENT_TYPE}/${COMPONENT_NAME}/cgi-bin"> | |
SSLOptions +StdEnvVars | |
</Directory> | |
BrowserMatch ".*MSIE.*" \ | |
nokeepalive ssl-unclean-shutdown \ | |
downgrade-1.0 force-response-1.0 | |
</IfModule> | |
RewriteEngine on | |
RewriteCond %{QUERY_STRING} ^p=1 [OR] | |
RewriteCond %{QUERY_STRING} ^p=4 | |
RewriteRule ^(.*) - [F] | |
</VirtualHost> | |
</IfModule> |
#T td[headers=NAME]{min-width:200px} | |
/* | |
#<リージョンの静的ID> td[headers=<列の静的ID>]{min-width:200px} | |
*/ |
</a><img src="#APP_IMAGES#ICON/#SEX#.png" alt="" /><a href="#" class="hideMe508"> | |
//-- 補足1 #SEX# の欄がインタラクティブレポートの列名 | |
//-- 補足2 <a href="#" class="hideMe508"> は、理由はよくわかりません。 (^^;) |
DECLARE | |
l_flag number := 0; | |
BEGIN | |
SELECT PWD_EXPIRE into l_flag from USERMASTER WHERE upper(USERNAME) = upper(:APP_USER); | |
IF l_flag = 1 | |
THEN | |
htp.init; -- OWA_UTIL呼ぶには必要らしい | |
owa_util.redirect_url('f?p=&APP_ID.:4:&APP_SESSION.'); -- &APP_ID.:<page no>:&APP_SESSION. | |
apex_application.stop_apex_engine; | |
ELSE | |
NULL; | |
END IF; | |
END; |
PROCEDURE UPSERT_TABLE(C_1 in VARCHAR2, | |
C_2 in VARCHAR2, | |
C_3 in VARCHAR2, | |
C_4 in VARCHAR2) | |
as | |
BEGIN | |
MERGE INTO <TARGET TABLE> A | |
USING DUAL --- プロシージャで1件ずつ追加/上書するなら、DUALで可能 | |
ON (<COLUMN_1> = C_1 | |
and <COLUMN_2> = C_2 | |
and <COLUMN_3> = C_3 | |
and <COLUMN_4> = C_4) | |
WHEN matched then | |
update set <FLAG> = case <FLAG> when 1 then 0 | |
when 0 then 1 | |
END | |
WHEN not matched then | |
insert(<COLUMN_1>,<COLUMN_2>,<COLUMN_3>,<COLUMN_4>,<FLAG>) | |
values(C_1,C_2,C-3,C_4,1); | |
end; |