#include
#include
#define fld_max_buff_len 2048
#define max_buff_num 1
#pragma pack(1)
char *ltrim( char
* str
) /*去掉str右邊的空格*/
str[len] = '/0';
return
str;
}typedef char * filed;
intmain(int
argc
, char *argv
)fptr = fopen(argv
[4],"rt");
if (fptr == null)
tm = get_milli_time();
sqlallocenv(0 );
rc = sqlconnect( 0,"",0,(uchar *)argv
[1],0,(uchar *)argv
[2],0);
if (rc != sql_success)
rc = sqlallocstmt(0,&hstmt);
if (rc != sql_success)
rc = sqlallocstmt(0,&hstmt1);
if (rc != sql_success)
sprintf(tmpsql,"select * from %s where 1 != 1",argv
[3]);
rc = sqlprepare(hstmt,(uchar *)tmpsql,0);
if (rc != sql_success)
rc = sqlexecute(hstmt);
if (rc != sql_success)
sqlnumresultcols( hstmt,( sword far *)&counts);
num = 0;
sprintf(tmpsql,"insert into %s values ( :v0",argv
[3]);
for (i = 1; i < counts ; i++)
strcat(tmpsql,")");
for (i = 1; i <= counts ; i++)
}rc = sqlprepare(hstmt1,(uchar *)tmpsql,0);
if (rc != sql_success)
tot_num = 0;
while (1)
for ( k = 0 ; k < max_buff_num ; k++ )
num++;
tmp_pos = tmpstr;
for (i = 0; i < counts ; i++)
if ( j < fieldlen[i]-1 )
tmp_pos ++;
/*if (fields[i][k * fieldlen[i]] == '/0')
for (j = 0; j < fieldlen[i] ; j++ )}*/
}}
if ( num > 0 )
}if (sqlexecuteex(hstmt1,num) != sql_success)
tot_num += num;
commit_tran(sql_null_hdbc);
}tm2= get_milli_time();
if ( is_continue == 0)
} /*end while*/
commit_tran(sql_null_hdbc);
fclose(fptr);
tm2= get_milli_time();
printf("/t共有 %d 行被倒入,共耗時: %12.3lf 秒/n" , tot_num , tm2 - tm);
sqlfreestmt( hstmt, sql_drop);
sqlfreestmt( hstmt1, sql_drop);
sqlfreeenv(0);
return 0;
}
ORACLE資料匯入Shell程式
usr bin ksh oracle資料載入shell if ne 3 如果引數不等於3個 then echo load.ori user passwd table name data file exit fiif f 3 如果第三個引數不是檔案 then echo 3 file no found ...
oracle匯入資料
create the user create user user identified by 123456 default tablespace users temporary tablespace temp profile default password expire grant revoke ...
oracle匯入資料
oracle匯入資料時出現的問題 alter user spowner default tablespace users ora 00959 表空間 tbs arch risk 不存在 create tablespace tbs arch risk datafile c oracle product...
Oracle匯入資料
oracle匯入資料 在sql plus中 1.c test.sql 2.imp 3.impdp server端 a.conn sys sys as sysdba b.creat directory dumpin idr as d dump c.grant read,write on directo...
oracle匯入資料
注意 1.保證在e oracledata盤下有一個fund data資料夾 2.保證在e oracledata盤下有一個匯入檔案,ds.dmp.匯入資料庫的步驟 1.登入sqlplus,在命令列輸入sqlplus username password sid 2.建立臨時表空間 drop tables...