Utl_file issue..plzz help
Hi alll...
Sorry, If this question is already answered in some other posts.
Database: 11g
I am planning to generate a CSV by selecting some data from the database.
I am using UTL_file for this.But the main issue is, if ""each line size"" is less than 32k.
Everything is working fine.
The problem is some of my ""lines are more than 32k"".
each line. I am putting it in a CLOB. (as the line can more that 32k).
It seems utl_file.put_line has a limitation of 32k.Tried the following code:
Code 1:
v_clobLen := DBMS_LOB.GETLENGTH(out_str);
dbms_output.put_line('clob length '||v_clobLen);
WHILE v_pos < v_clobLen
LOOP
v_buffer := DBMS_LOB.SUBSTR(out_str, v_amount, v_pos);
EXIT
WHEN v_buffer IS NULL;
v_chr10 := INSTR(v_buffer,CHR(10),-1);
IF v_chr10 != 0 THEN
v_buffer := SUBSTR(v_buffer,1,v_chr10-1);
END IF;
UTL_FILE.PUT_LINE(fileHandler, v_buffer,TRUE);
v_pos := v_pos + LEAST(LENGTH(v_buffer)+1,v_amount);
END LOOP;The problem with code 1 is
It seems that utl_file.put_line puts a carriage return after every 32k.because of that, I am getting the output,
but the carriage returns are messing up my CSV fileANOTHER CODE 2:
FOR i IN 0 .. TRUNC ( (DBMS_LOB.getlength (out_str) - 1) / t_len)
LOOP
UTL_FILE.put_raw (fileHandler, DBMS_LOB.SUBSTR (out_str, t_len, i * t_len + 1));
END LOOP;Intead of utl_file.put_file, i tried utl_file.put_raw.
But somehow some of the data is getting truncating.
Not sure what is the issue with the Code 2:
Please help me with the code that can handle more that 32k data and can write to a CSV file.
Thanks
rp0428 wrote:
You can use PUT and then add your own line terminators. Use NEW_LINE and it will add platform specific terminators.No, you can not. UTL_FILE is a package to read and write operating system *<font color=red>text</font>* files. And UTL_FILE restriction is: file is a stream file with NEW_LINE serving as record (line) separator. Max record size is whatever specified in FOPEN as parameter max_linesize and can not exceed 32767 (including new line). Below is an example:
SQL> DECLARE
2 f UTL_FILE.FILE_TYPE := UTL_FILE.FOPEN('TEMP', 'FileName.txt', 'w', 32767);
3 buffer varchar2(10000) := LPAD('A',9999,'B') || 'A';
4 BEGIN
5 UTL_FILE.PUT(f, buffer);
6 UTL_FILE.PUT(f, buffer);
7 UTL_FILE.PUT(f, buffer);
8 UTL_FILE.FCLOSE(f);
9 END;
10 /
PL/SQL procedure successfully completed.
SQL> As you can see, when total size does not exceed 32K, it works fine, but as soon as it exceeds 32K:
SQL> DECLARE
2 f UTL_FILE.FILE_TYPE := UTL_FILE.FOPEN('TEMP', 'FileName.txt', 'w', 32767);
3 buffer varchar2(10000) := LPAD('A',9999,'B') || 'A';
4 BEGIN
5 UTL_FILE.PUT(f, buffer);
6 UTL_FILE.PUT(f, buffer);
7 UTL_FILE.PUT(f, buffer);
8 UTL_FILE.PUT(f, buffer); -- here we are exceeding 32767
9 UTL_FILE.FCLOSE(f);
10 END;
11 /
DECLARE
ERROR at line 1:
ORA-29285: file write error
ORA-06512: at "SYS.UTL_FILE", line 77
ORA-06512: at "SYS.UTL_FILE", line 690
ORA-06512: at line 9
SQL> What you can is open file in binary mode, then:
SQL> DECLARE
2 f UTL_FILE.FILE_TYPE := UTL_FILE.FOPEN('TEMP', 'FileName.txt', 'wb', 32767);
3 buffer varchar2(10000) := LPAD('A',9999,'B') || 'A';
4 BEGIN
5 UTL_FILE.PUT_RAW(f, UTL_RAW.CAST_TO_RAW(buffer));
6 UTL_FILE.PUT_RAW(f, UTL_RAW.CAST_TO_RAW(buffer));
7 UTL_FILE.PUT_RAW(f, UTL_RAW.CAST_TO_RAW(buffer));
8 UTL_FILE.PUT_RAW(f, UTL_RAW.CAST_TO_RAW(buffer)); -- here we are exceeding 32767
9 UTL_FILE.FCLOSE(f);
10 END;
11 /
PL/SQL procedure successfully completed.
SQL>SY.
Similar Messages
-
Plzz help my adudition is still in trial mode!
I have been in contact with your support a couple of times the last 2 days and they cant find the issue. But now the last time they said that i should try to install audition on another computer so i did and i get the same problem still, it still says ''trail'' in the background of my sound files so it most have something to do with my subscription? It also says that i need to complete my adobe id profile to regiter the product, but i have allready done that? Plzz help!
As a U2U group, we can't deal with this at all - installation issues are not our province at all. The best we could offer is to hope that one of the developers comes along and takes pity on you. On the face of it, this sounds like a Cloud issue though, not necessarily Audition at all; you might want to post on the Cloud forum (if there is one...)
-
Whenever i try to open my after effect it just says error 15 n dont work plzz help me out
whenever i try to open my after effect it just says error 15 n dont work plzz help me out
We cannot know. you are not telling us anything about your system, what kind of project, what footage etc. We don't even know what version of AE!!! In any case, run the Creative Suite Cleaner Tool, reinstall the program. If the issues persist, we realyl need a lot more info to help you.
Mylenium -
Mid 2010 15" MBP i5 A1286 POWER ISSUE-PLEASE HELP-
The MBP works fine when mains connected but the only issue is every time I take the charger out it shuts down on me!!! So I have checked with a multitester & looks good the only thing i find hard to check for power is the battery itself as its hard to get a good connection, also I took to local Apple store & they checked with a new battery but said its still same issue so the guy disconnected nearly all the connecters off to check if they causing issue & he said now the battery is charging.
So they still have the laptop to do further tests etc, but I’m not sure what could be the problem hear as maybe there is some component which is bad so the battery’s not charging or what else could be the issue please help & advice as I’m really confused as if it was something to do with the logic board then surely it would not even charge even after checking with the multitester or like Apple genius done by disconnecting other components...
ANY HELP OR ADVICE WOULD BE HELPFULL,
THANKS GUYSTHANKS FOR THE HELP GUYS!!! BEEN AROUND 5 DAYS & NOT ONE PERON HAS HELPED...
BUT YEAH THANKS AGAIN...
WASTE OF TIME THIS IS... -
I am having major issues with links in keynote! Even though the links (a navigation system) are on the master page, they are only working on some of my slides. Anyone have ideas on how to fix this or similar issues? Help!
I have created a navigation system on the master pages and set the presentation to links only mode. I also have other links scattered throughout the program, like a linkable table of contents, etc. Some of them work, some of them don't. Not sure why. Anyone out there having similar issues? Or have any idea on how I can solve this issue? Any help would be appreciated!
Thanks!Links should not create any problems in Keynote. If they are set up correctly on text, the text will be underlined. Objects that have links will have a curved arrow bottom right, if you click the arrow a popup will display the link information.
Try this repair for Keynote, ensure you complete all the tasks and in the order shown:
1
delete all the iWork applications if you have them, not just Keynote, using Appcleaner from Mac Update, its a freeware application
2
empty the trash: Finder > Empty Trash
3
Shut down your Mac, wait 30 seconds, then power on the Mac, immediately after the start chime, hold down the Shift key
When you see the grey Apple symbol and progress indicator (a spinning gear), release the Shift key.
If you are prompted to log in, type your password, then hold down the Shift key again as you click Log in.
4
Let the Mac fully boot up, it will take longer as the OS is repairing the drive
5
when fully booted, go to Applications > Utilities > Disc Utility; click on the boot drive then First Aid tab and click repair disc permissions
6
when complete, restart the Mac normally, Apple menu > Restart
7
install Keynote from the Mac App Store
let us know if this helped -
hi ive upgraded my itouch to ios 6.1.3 but it keeps crashing ounce i put my passcode in is there a way i can fix this? one of my friends mentioed downgrading it but the only way isnt supported by apple so i dont feel safe with it so plzz help me.
it has worked fine no problems till i updated it i tried restoring itwith my old backup but it doesnt move the ios back so it just keeps on craching when i try to unlock itTry:
- Reset the iOS device. Nothing will be lost
Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Restore from backup. See:
iOS: How to back up
- Restore to factory settings/new iOS device.
If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
Apple Retail Store - Genius Bar
Downgrading the iOS is not supported by Apple -
it is shwing that it has ebcountered an eror from reading from its preview cache and needs to qiut...
after re-instalation also it i still showing the same thing... plzz help me.That error message indicates that your preview cache files have become corrupt. This is not a critical problem to solve. Just delete the previews file it carries the same name as your catalog file with the extension ending "Previews.LRDATA" see the screen capture. Delete this file and when you next restart Lightroom it will rebuild the previews.
The link below will let you know where the file is located.
Preference and other file locations | Lightroom 4 -
i have the new ipad and inserted a new tata docomo sim in it, it shows network but is not able to connect to the internet,,, can any1 plzz help me out
Let's start with the most obvious? Have you paid for service? If yes, thry THIS.
-
Why does my ipad2 no longer receive photos on iMessage? Iphone works perfectly with iMessage photos. Ipad2 used to work fine. Is it an ios8 issue? Help!
Hello,
Where may I be able to contact and speak with a prepaid representative? Strictly through phone calls? (I am at work 12 hours a day)
And I apologize for posting in the wrong area - I saw Apple support so I went here.
I'm almost certain my phone is the problem. I have gone through resetting the network settings a dozen times on my phone, even did it on my dad's. Now my texts are beginning to do the same when I text my fiance.
Resetting the network settings DOES work -- the problem is it will work for a day or two or for only a few hours - then I'll have to do it all over again. -
hi, i just bought a MacBook pro . and i entered the store and it said that i have to update iphoto so i enter my email and password and it said " you have updates on other accounts, sign in to the account u used to purchase this item" .. and i didnt purchase it it was there when i bought the laptop , plzz help.
THANK YOUSame thing for me it writes "To update this application, sign in to the account you used to purchase it."
-
Just updated to my macbook pro to 10.8.2. ical not synching with my Exchange 2010 server. Worked flawlessly prior to the upgrade. Settings set to auto discover. I matched settings of a partner in my who is still using 10.7.1 without issues. Help!
Also - my battery has been telling me "service battery" for a LONG time and then it switched to "replace soon" som time ago. Can't really see what this has to do with anything but whatever.
That could conceivably explain all the problems you're describing. Replacing a Mac's battery should not be postponed since a failed battery will cause other problems to occur. It is also possible that its hard disk has failed, which means the information on it may soon become unrecoverable.
... my latest TM back up was from April 2014, can I just run this when I have rescued everthing and then it might not be as slow?
If that Time Machine backup remains intact, it may be the only viable means of recovering that Mac's information. I suggest you do not attempt to restore its contents to your ailing Mac.
Given that you are having trouble creating a newer Time Machine backup you should stop using that Mac immediately and have it serviced as soon as you are able. Do not take it to anyone other than Apple or a service facility authorized by Apple, for the very reasons you explained. If there are no Apple Stores in your vicinity search for an Authorized Apple Service Provider using the Contact Us link below. Use one of the options that appear under Contact Apple Support. The language on that page will be different for your location. -
Finished Installation..ERROR in starting the SERVER PLZZ HELP
Hi,
I could complete the installation of SAP WAS from the cd with host n keller successfully.
But now when i make a set up and try to logon with the SAP GUI , It gives an error saying the host couldnt be find and in the meanwhile on ABAP ENGINE STARTUP SCREEN it starts the server and then immediately shuts down showing : Work process xx died..and ICM shut down successful.
Plzz help me as to if any settings are causing this or wat should i do to splve this.
Thanks,
ShilpiHi,
Did you configure loopback adapter and assigned a ip address to it? If it is done, then try to increase virtual memory.
Sabita -
URGENT: REGARDING ROUTING REPORT(plzz help me out)
Hi,
I am making a report in which i have to display the stock during the routing i.e. in CA03 we get to know which are the operations are implemented on a material. the requirement is if there are 50 pcs of material are in 1st operation and only 10 materials are able to reach next stage of operations ,then how many pcs of a material are left among them? i want to know which are the tables used for these qtys as i am checking that in CA03 the values are in structure and i want to know in which tables these quantities to be present.
plzz help me out as it is really urgent and help will be definitely rewarded.
Edited by: ric .s on Apr 1, 2008 7:45 AMhi,
can anybody tell me which are the tables used in the routing? -
someone plzz help me i m so confused!!!
Try resetting the phone. Push both the home and lock button at the same time until it goes off. Keep them pushed until the Apple logo come up...
Also, try deleting the app and downloading it again. -
After updating to 10.6.3, I installed the 10.6.8 update just to start experiencing these font issues. HELP! How do I get the fonts to display correctly in my browsers especially (Chrome & Safari)
What I ended up having to do was open up the Font book & remove duplicates. I knew it was Arial that was causing the problem, so I deleted the duplicate of that font. Inadvertantly I deleted all the Arial regular font, so I had to reinstall one copy. That was the solution. Thanks!
-
Hi iam using IPHONE4 , when i coonect it to my PC , itunes get hang and don't detect my iphone , how i can sort out this issue plz help me
iPhone, iPad, or iPod touch not appearing in iTunes
Maybe you are looking for
-
Create Accounting when completed in warning the output is coming in XML
Hello to all, I am having APPS version 12.1.3 OS version OEL 5.5 my problem is that when i am running Create Accounting concurrent request if it completes in warning the output (view output) is coming in XML in browser where as if its completing norm
-
Installing Adobe tryout messed up a number of icons in Preferences
Hi all, Yesterday I installed "tryout" (i.e. demo) versions of Adobe Photoshop (and ImageReady). I've noticed that many of the icons in my Preferences folder have been hijacked and the Get Info box refers to them as "Adobe ImageReady Preferences" fil
-
How to Authorize external table users in OBIEE 11g
Hi All, I have created Session System Variables and i am Using External table Data level Authentication and successfully external table Authentication is working. My question is i want to Authorize this Extrenal table users in presentation services.e
-
We are looking for precedents on the use of PharLap or any RT sytem (VX Works, etc) used on cFP or PXI systems on classified networks. We don't need specifics on the application. A contact or location would be nice, but not required, even anicdotal
-
Why do I have lines on my landing page where i sliced it in Photoshop
I am making a very basic landing page, designed in photoshop, As I need two buttons, I have sliced my page before importing it to dreamweaver. Whilst initially it shows in the webbrowser correctly, when I zoom in and out it starts to show the lines