Read the file into a LOB
I have a file of text stored on a file system. I want to write a procedure that reads the file and load it into a CLOB. I want while CLOB email to myself.I borrowed the code to go from many different sources and come up with this:
DECLARE
v_clob CLOB;
v_srcfile BFILE := BFILENAME('DATA_PUMP_DIR', 'MYTEXT.csv');
v_warning number;
v_dst_offset number := 1 ;
v_src_offset number := 1 ;
v_lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX;
BEGIN
DBMS_LOB.OPEN(v_srcfile, DBMS_LOB.LOB_READONLY);
DBMS_LOB.LoadCLOBFromFile(
DEST_LOB => v_clob
, SRC_BFILE => v_srcfile
, AMOUNT => DBMS_LOB.GETLENGTH(v_srcfile)
, DEST_OFFSET => v_dst_offset
, SRC_OFFSET => v_src_offset
, BFILE_CSID => DBMS_LOB.DEFAULT_CSID
, LANG_CONTEXT => v_lang_ctx
, WARNING => v_warning
);
DBMS_LOB.CLOSE(v_srcfile);
COMMIT;
send_mail(p_to => '[email protected]',
p_from => '[email protected]',
p_subject => 'Email from Production DB',
p_text_msg => 'Contents of a CSV file are attached',
p_attach_name => 'test.csv',
p_attach_mime => 'text/plain',
p_attach_clob => v_clob,
p_smtp_host => 'smtp.www.com');
END;
/
When I run the present, I get the following error:ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 960
ORA-06512: at line 12
06502. 00000 - "PL/SQL: numeric or value error%s"
*Cause:
*Action:
The error "invalid LOB locator" is, in my view, usually thrown when the mentioned file does not exist. But mine (checked several times, including problems of upper/lower case,). The user has also obtained the read/write permissions on the object of the directory DATA_PUMP_DIR.Could someone explain why I get the error invalid LOB, and what can I do to fix it, please?
Taking stock of sb90275 a little clearer, the problem seems to be that you do not create a temporary LOB to V_CLOB before you pass it to the LoadCLOBFromFile command in.
If I reproduce the beginning of your code on my system, I get the same error
SQL> ed
Wrote file afiedt.buf
1 DECLARE
2 v_clob CLOB;
3 v_srcfile BFILE := BFILENAME('DATA_PUMP_DIR', 'dp.log');
4 v_warning number;
5 v_dst_offset number := 1 ;
6 v_src_offset number := 1 ;
7 v_lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX;
8 BEGIN
9 DBMS_LOB.OPEN(v_srcfile, DBMS_LOB.LOB_READONLY);
10 DBMS_LOB.LoadCLOBFromFile(
11 DEST_LOB => v_clob
12 , SRC_BFILE => v_srcfile
13 , AMOUNT => DBMS_LOB.GETLENGTH(v_srcfile)
14 , DEST_OFFSET => v_dst_offset
15 , SRC_OFFSET => v_src_offset
16 , BFILE_CSID => DBMS_LOB.DEFAULT_CSID
17 , LANG_CONTEXT => v_lang_ctx
18 , WARNING => v_warning
19 );
20 DBMS_LOB.CLOSE(v_srcfile);
21* END;
22 /
DECLARE
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified:
ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 890
ORA-06512: at line 10
If I add a line to initialize the V_CLOB before using it, the code works as expected
SQL> ed
Wrote file afiedt.buf
1 DECLARE
2 v_clob CLOB;
3 v_srcfile BFILE := BFILENAME('DATA_PUMP_DIR', 'dp.log');
4 v_warning number;
5 v_dst_offset number := 1 ;
6 v_src_offset number := 1 ;
7 v_lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX;
8 BEGIN
9 dbms_lob.createTemporary( v_clob, true );
10 DBMS_LOB.OPEN(v_srcfile, DBMS_LOB.LOB_READONLY);
11 DBMS_LOB.LoadCLOBFromFile(
12 DEST_LOB => v_clob
13 , SRC_BFILE => v_srcfile
14 , AMOUNT => DBMS_LOB.GETLENGTH(v_srcfile)
15 , DEST_OFFSET => v_dst_offset
16 , SRC_OFFSET => v_src_offset
17 , BFILE_CSID => DBMS_LOB.DEFAULT_CSID
18 , LANG_CONTEXT => v_lang_ctx
19 , WARNING => v_warning
20 );
21 DBMS_LOB.CLOSE(v_srcfile);
22* END;
SQL> /
PL/SQL procedure successfully completed.
Justin
Tags: Database
Similar Questions
-
I just looked at problems with importing files from nikon D810 in LR 5.7 it pop a window saying it can't read the files to work on an imac 27 "yosemite on my mac pro running after several times he finally managed to read files and import them into LR, I never had this problem before there was a sort of update that could from cause?
What is the destination folder that the date be underneath? In the top right it says users who suggests, you try to put the photos on top of your username instead of under your username. Maybe that's the problem. So change your folder in the drop-down list at the bottom right of what it should be rather than users, and if you're going to show us the destination of your photos at least scroll through the list of folders down right so that we can see which is the white highlight.
Here is how mine looks like if I want to put my photos imported under my subfolder users - Steve - photos by date:
-
My wireless on my laptop will read the files on my desktop but I can't connect to the internet, hard wire my laptop iI unless other computers work fine
The following diagnostic information:
- Connect your laptop wireless so that you can "read the files on your desktop."
- Open a command prompt window (start > run > cmd > OK)
- Type the following command in the black command prompt window and press enter
ipconfig/all > "% userprofile%\Desktop\testdata.txt".
- Let the window open orders and "hard wire" your laptop to connect to Internet
- Type the following commands in the black command prompt window and press ENTER after each one
ipconfig/all > "% userprofile%\Desktop\testdata.txt".
Notepad '% userprofile%\Desktop\testdata.txt '. - Copy and paste the contents of the testdata.txt file into your answer here
Please note that there are 2 for the second command ipconfig > characters.
You can close and remove testdata.txt (which is located on your desktop) and close the command prompt window.
-
I need to read a file into a string. Here is what I use:
Could you confirm that db.txt is in the res folder and this res folder is in the root directory (IE your project folder)? Have you tried readFile("/db.txt") like Peter mentioned above?
-
Err: Could not read the file action
Running Acrobat Pro of XI on Win7.
Two stocks on the part of the Action Wizard, generate err pop up when I click on them. Path, cited in the error message is in Program Files (x 86) \... \ENU directory.
Two of them are trying to read the file .sequ same, but have different description text showing.
At one point, I had copied existing files in sequence, using them to edit and create mine, I then imported into Acrobat.
Acrobat displays to manage Actions, but delete is dimmed; probably because what they resemble somehow action out-of-box.
Even if I temporarily MOVE all files .sequ to \ENU directory and appdata files, they ALL actions always show on the Actions pane, and these two may not always be deleted.
How to removed portion entered component shares of the wizard? -or-
How to reset installation - preference only the part of it that involves the .sequ files?
Thank you
Dave
Hi DrDaveJ,
Open Acrobat XI, go to the Help menu and repair the installation.
Make sure that Acrobat XI is updated to 11.0.13 version, you can check for updates under the Help menu, if any please install.
Now, try to remove the create action. Refer to this KB document to handle the Action Wizard Acrobat help. Wizard action.
Kind regards
Nicos -
I want to copy a file to both folders and then delete the original file in a BPEL process. The file is large (100 MB), so I don't want to read the contents of the file. In addition, the process is started by another process, so I'll have to do the synchronous copy or read/write.
Is this possible in BPEL 11 g?I also faced the same problem.
You can use Sync Read to copy the file into the file system. Check the details here:http://docs.Oracle.com/CD/E21764_01/integration.1111/e10231/adptr_file.htm#CHDEEDGC
You need to replace the options in the file JCA that these options are not available in the wizard. Test and let us know if it works.
-
I am trying to record an mp3 file, but firefox does not allow me to save... it allows me to read the file but not download and asave to my computer. How can I activate the Firefox save MP3s on my computer?
Go to Options > Applications tab > MPEG Layer 3 audio(audio/mpeg) image search > use the "Save file" option on the menu drop down.
-
How to read the files on time capsule
How to read the files on time capsule from iPad?
Thank you
Using an application like navigation on the iPad. More info here:
-
Original title: Windows Media Player
When I go to play a movie using windows MediaPlayer all I get is an imagwe again with audio and this message 'network is too busy to read the file to its original quality. Also, all my other media playing programs read the video but are rather "lag". I think the problem is that I already used a program to download torrents called 'BitTorent' and maybe this has used up all my bandwidth or processing speed? Not really sure but would really like it if I could still use WMP and I'm looking for resolution to my problem?
Thank you
Hi Jeremy,.
It seems that you have problems with playback of video files in Windows Media Player.
1. what operating system do you use?
2. this happens with all the videos?If you use Windows 7, here are a few troubleshooting steps that you can try.
Method 1: Try to run the troubleshooting Windows Media Player settings Troubleshooter:
http://Windows.Microsoft.com/en-us/Windows7/open-the-Windows-Media-Player-settings-Troubleshooter
Method 2: If the problem persists, try to disable and enable Media Player and check.
Step 1: turn off Windows Media Player:
a. go initially and in search type 'Turn Windows has or not'.
b. click on "Turn Windows features on or off".
c. find multimedia and uncheck Windows Media Player.
d. restart the computer.
Step 2: Enable the Windows Media Player:
a. go initially and in search type 'Turn Windows has or not'.
b. click on "Turn Windows features on or off".
c. find the multimedia functions and place a check mark in front of the Windows Media Player.
d. restart the computer.For more information, see the article:
http://Windows.Microsoft.com/en-us/Windows7/turn-Windows-features-on-or-off
Method 3: Try to re register the wmp.dll file and check if it helps.
a. log on as an administrator.
b. click Start, type cmd in the text box Search , right-click on cmd.exe, click run as administratorand then click continue.
c. at the command prompt, type regsvr32 wmp.dll, and then click OK.I hope this helps!
-
I keep my music on a SD instead of on my hard drive... the Player Windows media won't let me play music... can I use wmp to discover & read the files only located on one sd card?
Hi radioman9,
also try this link:
http://Windows.Microsoft.com/en-us/Windows-Vista/Windows-Media-Player-library-frequently-asked-questionshope this helps
Eddie -
Windows Media Player error when you try to read the file: error downloading codec
Yesterday, I got no sound and video, today I have sound but no video. What is happening with this?
I updated my drivers and now the video does not work. I use Windows Media Player c. 9.00.00.4510. When I click on read the file, in the black bar at the bottom ready it flashes very fast "error downloading codec". Before I updated the drivers, I got the video with no sound. Where this codec disappeared to? How can I get that back?
I have updates for the 9 Series Player and I'm happy with it. If I move up to 10 or 11, codecs and drivers will work with it automatically or will I have the same problem?
OS: Windows XP sp3
Thanks for any help, Cdee.
Hi CDEKV,
Check to see if the following is useful.
Method 1: Follow the steps in the below article mentioned to see if it helps.
How to Download Codecs automatically in Windows Media for Windows XP player
Method 2: Install the Codec Installation Package to check the issue.
Download details: Codec Installation Package
Method 3: Upgrade to the latest version of Media Player.
-
Windows XP will not read the files on the second drive...
After reinstalling Windows XP on a new drive C:... How can I get Windows XP... to read the files on a second drive F:...?
You will need to take possession first. See article KB- How to appropriating a file or a folder in Windows XP.
-
8007007E tips
There is also another number which is C00D11B1, but both have to do with the lock of the music in windows media player, the message said:-"Windows media player has encountered a problem reading the file; for help click web help. ""- and that of all, but when ' web help ' click on the show numbers that are 8007007E and C00D11B1 and average music, not Windows media player, y at - it someone with the same problem that has been able to solve? Thank you, let me know, if you don't mind, thank you again.
I suggest re-download you WMP 11 from the following link and install it on top of the current installation:
http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=1d224714-e238-4E45-8668-5166114010ca
Who help me?
If this isn't the case, please report the file type (extension) of the file you are trying to play. For instructions on how to make Windows Explorer shows the file types, see this link:
http://www.windowsreference.com/Windows-XP/how-to-view-all-file-extensions-in-Windows-XP
-
For some reason any, that my Windows Contacts show now an icon of Adobe for each of them, and when I try to open Adobe Reader 9.0 starts, then tells me that it can't read the file. I tried right-clicking and using "open with...". "to set a default value, but no other programs are listed as possibilities. By clicking on 'Browse' of course gives me a window of the Explorer, but I have no idea what program select open Windows Contacts with.
Contacts Windows used to work perfectly, and I have no idea if this problem started, or why.
Can someone tell me how to open them properly, with the Windows Contacts program? Thank you!
original title: my Windows Contacts have Adobe icons and does not (Hijacked by Adobe Reader 9.0?)Go to: Control Panel, programs by default, associate a type of file or Protocol with a program.
Scroll down to:...
.contact... Click here to highlight, click on change program, click Windows Contacts.
Make sure that there is the box... Always use the selected program to open this type of file.
Repeat the process for:...
. Group
. P7C
.vcf
(Protocols)
LDAP
-
I have an emachine computer and I put my music on discs and put it in my new computer. the only problem is that this message keeps coming up. Windows Media can not read the file. the player might not support the file type or does not take in charge the codel that was used to compress the file. need help
Your computer may be missing code, download and install K-lite code pack can solve the problem. K-lite code Pack is free and safe, and it includes almost every video code and audio code.
Maybe you are looking for
-
Pavilion 500-110ej: BIOS not shown on the screen
When I turn on my pc it starts directly at windows and does not show the BIOS/post where I could click f10 or something and niether, it shows the HP logo. When I hit the spam button f10, the screen remains black and white, my guess is that he entered
-
Block sms and imessage for number/contact without their u call blocking?
Is it possible to block a contact or number of smsing only you and not from u call?
-
Satellite A200 - 220 (PSAE3E) stop unnexpectedly
My laptop stopped unnexpectedly without even reaching the session menu.I've updated form Vista Home Edition to a Windows 7 Professional Edition, and my laptop crashes... I've been using techniques from toshiba and said they could not help me, but I r
-
How to delete file search history? __
Hi can anyone tell me how to clear history folder? [Not the browser history]
-
(Redirected) PowerEdge SC440
Can you please help me with that? I bought a used PowerEdge SC440 without Ram memory and you want to reinstall them all. I formatted the hard drive and placed 4 new dimm 5300 u. the message I get when starting: System stopped! Floppy drive seek fail