2019-12-08から1日間の記事一覧

ランダム値取得

OS

Ubuntu (16)--0以上100未満の数値 awk 'BEGIN{ srand('"$RANDOM"'); print int(rand() * 100) }' while true;doawk 'BEGIN{ srand('"$RANDOM"'); print int(rand() * 100) }'done --10文字cat /dev/urandom | base64 | fold -w 10 | head -n 1 while true;do…

IF EXISTS

DB

Oracle (12cR1) --テーブル select * from user_tables where table_name ='TAB1'; create table tab1(col1 int);create table if not exists tab1(col1 int);→「create table if not exists」は未対応 drop table tab1;drop table if exists tab1;→「drop t…

カラム追加時のデフォルト値

DB

Oracle (12cR1) drop table tab1 purge;create table tab1(col1 int); insert into tab1 values(1);commit;select * from tab1; alter table tab1 add (col2 int);alter table tab1 add (col3 int not null);→ORA-01758: 必須列(NOT NULL)を追加するには、表…