Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Bfiles

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-04-03, 13:19
Fireball Fireball is offline
Registered User
 
Join Date: Dec 2003
Posts: 1
Unhappy Bfiles

Hello,

I just want to get some chars from a textfile to be shown via SQL+. My intention is to demonstrate the random access possibility to a LOB in Oracle.
Therefore I put a BFILE into a table and try to read and output a small part from the referenced textfile to the screen.

Here is my code:

CREATE TABLE PLSQL(
text_id NUMBER(5) PRIMARY KEY,
text_file BFILE)

CREATE OR REPLACE directory SAMPLES as 'C:\samples'

INSERT INTO PLSQL(text_id,text_file)
values(1,BFILENAME('samples','erle.txt'))

declare
locator_var BFILE:=BFILENAME('SAMPLES','erle.txt');
amount_var INTEGER;
offset_var INTEGER;
output_var VARCHAR2(10);
begin
amount_var:= 10;
offset_var:= 1;
select text_file into locator_var from PLSQL
where text_id = 1;
DBMS_LOB.OPEN(locator_var, DBMS_LOB.LOB_READONLY);
DBMS_LOB.READ(locator_var, amount_var, offset_var, output_var);
DBMS_OUTPUT.PUT_LINE('Begin of Erle: ' || output_var);
end;
/

COMMIT;


when I run the skript I get the following error message:
"SQL> start demo_plsql;
declare
*
FEHLER in Zeile 1:
ORA-22285: Verzeichnis oder Datei für FILEOPEN-Vorgang ist nicht vorhanden
ORA-06512: in "SYS.DBMS_LOB", Zeile 672
ORA-06512: in Zeile 11"

The directory exists and the file is also there.
So where could be the problem?

In hope for any suggestions.

Max
Reply With Quote
  #2 (permalink)  
Old 12-11-03, 17:08
joebednarz joebednarz is offline
PC Load Letter???
 
Join Date: Dec 2003
Location: Oklahoma, USA
Posts: 347
Sorry, can't read German... yet

However, it looks like your problem is here:

Code:
INSERT INTO PLSQL(text_id,text_file) values(1,BFILENAME('samples','erle.txt'))

Input into BFILENAME first parameter needs to be upper case in order to match your specification in the CREATE DIRECTORY command.

JoeB
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On