你有多種方式,從UNIX命令提示符下插入Oracle數據庫數據。
1)從命令提示符
[[email protected]OLE1]$ echo "insert into EMP values (7001,'TESTUSER','CLERK',7902,sysdate,2500,800,10);"|sqlplus -s scott/tiger;
auto COMMIT upon EXIT.
2)從shell腳本
vi insert_stm.sh
echo "Insert Data into EMP table of scott."
sqlplus -s /nolog<
conn scott/tiger;
set heading on feedback on;
insert into EMP values (7001,'TESTUSER','CLERK',7902,sysdate,2500,800,10);
commit;
EOF
echo "Insert Done."
:wq
[[email protected] Desktop]$ sh insert_stm.sh
Insert Data into EMP table of scott.
1 row created.
Commit complete.
Insert done.
[[email protected] Desktop]$
注:如果您使用的是遠程數據庫,請使用 「@」 符號,如:
的sqlplus - s scott/tiger @ stringname;
conn scott/tiger @ stringname;