如何将oracle数据库的sql语句执行结果保存到一个sql文件中?

如何将oracle数据库的sql语句执行结果保存到一个sql文件中?,第1张

set feedback off heading off term off
set pages 0 trim on trims on lines 32767 long 999999
set echo off
spool resultsql
Select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0;
spool off
把以上部分放入一个脚本文件中再执行,会在当前目录下生成你要的文件resultsql

您好:

INSERT INTO 表 (字段)
VALUES ('UPDATE 表名 SET 字段=''值'' WHERE 条件 LIKE ''%关键词%''')

合理的使用转义字符即可。。。

请参考。。

以下随便用哪句都行:
1、exec masterxp_cmdshell 'bcp "select from 数据库名表名" queryout "c:\tttxt" -c -t ,-usa'
2、EXEC masterxp_cmdshell ’bcp 表名 out c:\rytxt -c -Sservername -Usa -Ppassword’
3、exec masterxp_cmdshell 'bcp 数据库存角色表名 out "c:\test4txt" -c -q -t"," -S"b你的服务器名称" -U"你的帐号" -P"你的密码"'


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/10377138.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-08
下一篇 2023-05-08

发表评论

登录后才能评论

评论列表(0条)

保存