I am writing a procedure to create a CSV file with the data in an Oracle table. I used "spool filename;"
but an error is coming. Can I use spool
in PL/SQL?
相关问题
- Can I skip certificate verification oracle utl_htt
- Can I skip certificate verification oracle utl_htt
- how to calculate sum time with data type char in o
- keeping one connection to DB or opening closing pe
- System.Data.OracleClient not working with 64 bit O
相关文章
- node连接远程oracle报错
- oracle 11g expdp导出作业调用失败,提示丢包。
- 执行一复杂的SQL语句效率高,还是执行多少简单的语句效率高
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- Difference between FOR UPDATE OF and FOR UPDATE
- Oracle USING clause best practice
- Is there a method in PL/SQL to convert/encode text
- PHP PDO installation on windows (xampp)
Creating an ascii file: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:459020243348 and http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:68212348056 and http://www.oracle-developer.net/display.php?id=425 .
I think that there are better ways to implement this on Oracle 10g/11g, but this should work fine on Oracle 9i or higher:
Here are a couple of links you might find helpful:
A PL/SQL Tutorial and SQL*Plus User Guide (11g)
If you only need the data in a cvs file you can do this:
create a sql file with the query like this:
then call sqlplus from a terminal like this:
No, SPOOL is a SQL Plus command so you would have to do this in SQL Plus:
You would probably also need to set some values before starting the process e.g.
... to get the correct formatting.
spool is a sqlplus command. it cannot be used in pl/sql.
it seems that you have been trying a variety of ways to get oracle to do your formatting and file saving. why not have your program that is calling the proc do this work for you?