LoginSignup
1
2

More than 5 years have passed since last update.

oracle 改行を含むinsert文をchr(10)でまとめる

Last updated at Posted at 2017-06-08

c++でまとめてみたw ひまだなぁ。

main.cpp
#include <fstream>
#include <iostream>
#include <string>
#include <iterator>
using namespace std;

int main(int argc,char *argv[]) {
    if(argc<2){
        cerr<<"set the param" <<endl;
        return -1;
    }
    ifstream ifs(argv[1]);
    string str;
    if (ifs.fail()) {
        cerr << "失敗" << endl;
        return -1;
    }
    while (getline(ifs, str)) {
        if(str[0]=='-' && str[1]=='-'){
            cout <<  str <<endl;
            continue;
        }
        if(str[0]=='R' && str[1]=='E' && str[2]=='M'){
            cout <<  str <<endl;
            continue;
        }
        if(*str.rbegin() != ';') {
            str=str + "'|| chr(10) ||'";
            cout <<  str ;   //ここが味噌かな
        }else
            cout <<  str <<endl;
    }
    return 0;
}
1
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2