Redian新闻
>
HELP!!! PL/SQL write to a file
avatar
HELP!!! PL/SQL write to a file# Database - 数据库
n*s
1
I am very new to PL/SQL. Wish somebody can help me out.
Try to write something to a local file from a procedure, not just spool the
buffer, coz the buffer has limit of 255 char per line which is not large
enough for me. If you know how to increase this, please let me know.
I googled and found a package called UTL_FILE. Following the syntex, I wrote
something like this:
DECLARE
f utl_file.file_type;
BEGIN
f := utl_file.fopen('c:/nerdgirl', 'test.txt', 'w');
utl_file.put_line(f, 'blahblah
avatar
y*i
2
I think the utility writes to relatively where the PL/SQL is executed. If you
are running it though TOAD but it's executing on the server, maybe it's trying
to write to the server.
If you use spool, I think you can change line size by
set linesize #
but I don't remember the limit of that number.

【在 n*******s 的大作中提到】
: I am very new to PL/SQL. Wish somebody can help me out.
: Try to write something to a local file from a procedure, not just spool the
: buffer, coz the buffer has limit of 255 char per line which is not large
: enough for me. If you know how to increase this, please let me know.
: I googled and found a package called UTL_FILE. Following the syntex, I wrote
: something like this:
: DECLARE
: f utl_file.file_type;
: BEGIN
: f := utl_file.fopen('c:/nerdgirl', 'test.txt', 'w');

avatar
m*g
3
As yongqi mentioned, you shoud use the unix directory in the server where
oracle DB runs, something like /tmp/nerdgirl etc.

you
trying
the
wrote

【在 y****i 的大作中提到】
: I think the utility writes to relatively where the PL/SQL is executed. If you
: are running it though TOAD but it's executing on the server, maybe it's trying
: to write to the server.
: If you use spool, I think you can change line size by
: set linesize #
: but I don't remember the limit of that number.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。