Created
July 16, 2014 06:07
-
-
Save doi-t/b893b7eea9b68a58b410 to your computer and use it in GitHub Desktop.
単純なinsertの繰り返しと、バルクインサートのDDLを生成するスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo "$0 [the number of insert] [output file]" | |
exit 1 | |
fi | |
nmemb_insert=$1 | |
ddlfile=$2 | |
cat <<- EOF > $ddlfile | |
use dbstudy | |
truncate table emp; | |
EOF | |
echo -n "insert into emp values" >> $ddlfile | |
for i in `seq 1 $nmemb_insert` | |
do | |
echo -n "(8000,'MySQL','DBA',null,sysdate(),5000,null,80)," >> $ddlfile | |
done | |
sed -i 's/,$/;/' $ddlfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo "$0 [the number of insert] [output file]" | |
exit 1 | |
fi | |
nmemb_insert=$1 | |
ddlfile=$2 | |
cat <<- EOF > $ddlfile | |
use dbstudy | |
truncate table emp; | |
EOF | |
for i in `seq 1 $nmemb_insert` | |
do | |
echo "insert into emp values(8000,'MySQL','DBA',null,sysdate(),5000,null,80);" >> $ddlfile | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment