Newbie: DBMS_OUTPUT problem.
Hi all,
I have a very basic question...
I wrote the code for the procedure as this
SQL> create or replace procedure looptest as
2 begin
3 for idx in 3..1 loop
4 dbms_output.put_line('a');
5 dbms_output.put_line (idx);
6 for idx1 in 1..3 loop
7 dbms_output.put_line('b');
8 dbms_output.put_line (idx1);
9 end loop;
10 end loop;
11* end;
SQL> /
Procedure created.
SQL> exec looptest;
PL/SQL procedure successfully completed.
SQL> set serveroutput on;
SQL> commit;
Commit complete.
SQL> exec looptest;
PL/SQL procedure successfully completed.I wanted to see the result of running this procedure...
a.k.a some output like 3, 1, 2, 3, 2, 1, 2,... etc
question 1 : Why am i not able to see the result??
question 2: What should be done to see the result
Thanks in advance..
DBMS_OUTPUT is a server-side API (PL/SQL package). It allows PL/SQL code to write into a session static/persistent buffer in PL/SQL.
A client, like SQL*Plus, can then display the contents of this buffer after the PL/SQL code has completed execution.
The SQL*Plus command to enable this client feature (of displaying the buffer) is SET SERVEROUTPUT ON.
SQL> set serveroutput on
SQL> begin
2 for i in 1..10
3 loop
4 DBMS_OUTPUT.put_line( 'inside loop | counter='||i );
5 end loop;
6 end;
7 /
inside loop | counter=1
inside loop | counter=2
inside loop | counter=3
inside loop | counter=4
inside loop | counter=5
inside loop | counter=6
inside loop | counter=7
inside loop | counter=8
inside loop | counter=9
inside loop | counter=10
PL/SQL procedure successfully completed.
SQL>
Similar Messages
-
Base64 and dbms_output problem
Hello,
I'm trying to write a function that generate HTML content for sending inside a mail. This HTML content needs to have some picture inside it. To do so I'm using some conversion function from blob to base 64 encoding. To be sure that my function is working properly, I'm trying to execute it inside Oracle SQL developer.
The problem is that whenever I'm tying to show up any base64 content via dbms_output.put_line I got:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line xxx
06502. 00000 - "PL/SQL: numeric or value error%s"
Here is the part of the code where I'm trying to open file and convert it inside base64 content
With those variable:
-- locale variables
vc_mail_content CLOB;
vc_file_folder VARCHAR2(100);
vb_lFile BFILE;
vc_image_content CLOB;
vb_image_content BLOB;Code:
FOR c_file_name IN
( SELECT filename, folder
FROM MO_ITEM_IMAGES
WHERE item_id = R_lots.item_id)
LOOP
dbms_output.put_line('attachement '||c_file_name.fileName);
vb_image_content := NULL;
DBMS_LOB.CREATETEMPORARY(vb_image_content,true);
vb_lfile := BFILENAME('MO_DIR', 'webdav/'||c_file_name.folder||'/'||c_file_name.fileName);
DBMS_LOB.OPEN(vb_lfile, DBMS_LOB.LOB_READONLY);
DBMS_LOB.OPEN(vb_image_content, DBMS_LOB.LOB_READWRITE);
DBMS_LOB.LOADFROMFILE( DEST_LOB => vb_image_content,
SRC_LOB => vb_lfile,
AMOUNT => DBMS_LOB.GETLENGTH(vb_lfile));
DBMS_LOB.CLOSE(vb_lfile);
vc_image_content := zzz_mails.getbase64String(vb_image_content);
--/!\ This DBMS output creates the error /!\
dbms_output.put_line(vc_image_content);
DBMS_LOB.CLOSE(vb_image_content);
vc_mail_content := vc_mail_content||vc_image_content;
END LOOP; Whenever it reach the DBMS_output.put_line, I got the error.
The getbase64String function is a function that translate from blob to base64 clob
Can someone help me to solve this problem?
Thank you
Edited by: user13444434 on 3 juil. 2011 08:42DBMS_OUTPUT can not print CLOB in thay way. YOu can use a function like this:
PROCEDURE print_clob(p_clob in clob) as
l_offset number default 1;
BEGIN
loop
exit when l_offset > dbms_lob.getlength(p_clob);
dbms_output.put_line(dbms_lob.substr(p_clob, 255, l_offset));
l_offset := l_offset + 255;
end loop;
END print_clob;and call that in your original procedure. -
I am running oracle 8i on linux (mandrake 6) and have applied the
patch.
While playing around with some simple triggers etc I attempted to
use the dbms_output.put_line('stuff here') to keep track of, and
report on events as they happened.
The problem is that I do not get any output from these
statements.
for example I found this script elsewhere in the discussion group
(posted by someone using oracle on redhat 6):
declare
csr integer :=-1;
begin
csr:=dbms_sql.open_cursor;
if (csr = -1) then
dbms_output.put_line('Does not work!');
else
dbms_output.put_line('Works!');
end if;
end;
The output should be:
Works!
PL/SQL procedure successfully completed.
but on my system all I get is the second line, not the first.
Anyone have any ideas on why this would be so, and how to change
it.
Thanks
nullExecute 'set serveroutput on' before executing PL/SQL.
fintan (guest) wrote:
: I am running oracle 8i on linux (mandrake 6) and have applied
the
: patch.
: While playing around with some simple triggers etc I attempted
to
: use the dbms_output.put_line('stuff here') to keep track of,
and
: report on events as they happened.
: The problem is that I do not get any output from these
: statements.
: for example I found this script elsewhere in the discussion
group
: (posted by someone using oracle on redhat 6):
: declare
: csr integer :=-1;
: begin
: csr:=dbms_sql.open_cursor;
: if (csr = -1) then
: dbms_output.put_line('Does not work!');
: else
: dbms_output.put_line('Works!');
: end if;
: end;
: The output should be:
: Works!
: PL/SQL procedure successfully completed.
: but on my system all I get is the second line, not the first.
: Anyone have any ideas on why this would be so, and how to
change
: it.
: Thanks
null -
Sql developer - dbms_output problem
Hi
I am not getting any output using sql developer.
set serveroutput on;
begin
dbms_ouput.enable(10000);
dbms_output.put_line('abc');
end;
anonymous block completedI saw some threads ..with same problems. but I am not understanding where is that dbms_output tab in my sql developer ?
Tried alot .. but no use.
Please advise....!!!
Regards
RekhaIn your SQL Developer (usually at the bottom) there should be a tab "Dbms Output".
If there is not, then you probably have closed that tab at some point by accident - then you can get it back by going in the View menu and clicking Dbms Output.
In that tab is a green plus sign - if you hover over it you will see the tool tip "Enable DBMS OUTPUT for connection".
Clicking that green plus sign is similar to doing "set serveroutput on" in SQL*PLUS.
When I try it, somehow it only seems to work if I run my script using F5 rather than F9?
I think a good place to get further answers is in the SQL Developer forum - some of the people who write SQL Developer are helping out there ;-) -
Newbie Alert: Problem with saving downloads to a network drive
I'm a new Mac user so, I apologize for the newbie question.
I've have a NAS on my home network. I can see it and access it just fine. I have Firefox set to ask me where I want something downloaded. I don't get the option of putting, say a PDF in a folder on my network storage device.
I can put it anywhere on the iMac's hard drive or even a USB/Firewire drive but not a network location. In Windows, you'd map a drive and be off to the races.
How do I do this on a Mac?
Thank you in advance,
RickAFAIK, not doable for NAS HDs. Since you're new to Macs, you're going to have erase windoze stuff from you lexicon, check these out:
Switching from Windows to Mac OS X,
Basic Tutorials on using a Mac,
MacFixIt Tutorials, and
MacTips Learning Centre.
Additionally, *Texas Mac Man* recommends:
Quick Assist.
Welcome to the Switch To A Mac Guides, and
A guide for switching to a Mac. -
Newbie query problem: function data missing in dropdown
I am a student using 10g express provided with our textbook. The installation to WinXp SP3 went flawlessly and I can execute all required queries from the command line, no problem. The publisher provides SQL scripts related to the chapter material that creates the users and data for the chapter exercises. When I switch to the database home page and attempt to execute a query, I can change the aliases, insert conditions and do any thing else with the record but when I hit the dropdown arrow for function there is nothing there, no list. I have been back over the chapters dealing with installation thinking I have missed some setup parameter but I am coming up empty. Ay help would be appreciated.
Regards,
DaveLjuba,
This may be the issue as I ran the script as 'system' but logged in the database as 'handsonxe03'. I may have missed the required login from the text. I will look closer or I may have to modify the script for required user.
I will let you know....Thanks! -
Hi,
I persuaded my mum to get an i-mac so that a) her computing experience would be great and b) so that I could help her with any problems.
She is on 10.6 and Remote Client 3.4 and I'm on ARD 3.4 and 10.6.7. I set it up and connected with ARD fine in her house using my MBA. Control/Observe - all fine.
I then try and connect when I'm at home but am unable to do so.
I have her user name, password and IP address - 192.xxx.x.x
In Scanner I have a little blue dot to the left of the 192.xxx.x. details.
Can someone talk me through what blindingly obvious thing I'm missing here?
Many thanks.IP numbers are usually 4 sets of 3 digits (86=086), you have one set too much
if ARD resolves your IP (adding adsl.virginmedia.com) and you get an authentication error, that could mean you're using a wrong username/password combo
the correct ARD login is the COMPUTER's user/pwd (email accounts are irrelevant), check system preferences>accounts
note that login/password are case sensitive
if your login is correct, and you still can't connect, you might want to start working on your router's firewall configuration, but I can't help you with that, you need your ADSL router/modem setup guide
PS. go to system preferences>security, is your software firewall on or off? -
Newbie having problems with image on form
In Design, I use both the "image" and "image field" tools to place a JPG image on my form, but the image does not show up on the form (the placement is there for the image, but not the image). How can I correct this problem?
I had this same problem in the past and I'll second the notion that changing the image from CMYK to RGB easily solves the problem. Or, just make sure your image is in a .PNG format.
-
Sqldeveloper EA3 dbms_output problem
Hello
The code:
begin
dbms_output.put_line('ok');
end;
displays nothing in window created via menu view/dbms output
I need to explicite run set serverouput on in worksheet using F5 or F9 to see results in "script output" window or "dbms output" window
For "script output" it seems to be normal
but for view/dbms output it was working different in previous releases set serverouput on was not requiredThis is how I get dbms_output.put_line to work;
-- test dbms_output.put_line
-- output shows in script output region
-- if dbms output view is on then clicking the green '+' and enabling the correct connection
-- may show the ouput in the dbms output region also
SET SERVEROUTPUT ON;
DECLARE
l_nbr NUMBER;
BEGIN
l_nbr := dbms_random.VALUE(1,999);
dbms_output.put_line(to_char(l_nbr,'999'));
END;
I cant get the 'insert link' button to work but here is the URL for the original workaround;
30EA2 dbms_output.put_line not working -
Newbie: OPEN_FORM problem...
Hi!
I created 2 forms (Frm1, Frm2). On the Frm1 is there button BT.
In its trigger WHEN_BUTTON_PRESSED:
show_window('wind2'); -- Second window in Frm1
hide_window('wind1'); -- Main window in Frm1
In this case it works, but wind1 is not hidden (WHY??)
When i add
open_form('Frm2');
i get error 41053 cann't find canvas...
If i keep onlu open_form('Frm2');
i get error 40010 Cannot read form Frm2. But it exist and
directly i can open it...
What's wrong with me? :)You probably have some problem with the path where the developer
looks for forms.So check in the registry the key FORMS60_PATH
under the LOCAL_MACHINE->SOFTWARE->ORACLE->HOME0 (or HOME1 or
something) if in the directories it has as parameters, is there
the directory you save you forms. If not add it . ;-)
This maybe solve your problems .... -
Ok Another newbie. Problems compiling
Ok I downloaded SDK 1.3.1_01 and installed it to:
C:\SDK 1.3.1_01 I am Building my first java program. (yes the old hello world). I am using note pad saving my work in c:\j24work\Hello,java.
To complie the program I went in to my c:\j24work director in dos and typed Javac Hello.java and get Bad command or file name.
My classpath is set in my autoexec.bat as CLASSPATH=C:\SDK 1.3.1_01
When I saved my work in notepad I saved as "Hello.java" with all files under format.
I have spent a few frustrating days at this and I am at witts end now. So PLEASE help.Ok I downloaded SDK 1.3.1_01 and installed it to:
C:\SDK 1.3.1_01 I am Building my first java program.
(yes the old hello world). I am using note paduse any other good editors like emacs ,vi,....... etc
if ur going to use java for devolpment means begin praticing it in
a good editor from the begining itself
saving
my work in c:\j24work\Hello,java.
To complie the program I went in to my c:\j24worku can compile it in any directory by
<any directory> javac c:\J24work\Hello.java
k director in dos and typed Javac Hello.java and get
Bad command or file name.bcas ur dos prompt does not recognize the "javac" command
My classpath is set in my autoexec.bat as
s CLASSPATH=C:\SDK 1.3.1_01set CLASSPATH =C:\SDK 1.3.1_01\bin;
When I saved my work in notepad I saved as
s "Hello.java" with all files under format.no problem with ur file name
I have spent a few frustrating days at this and I am
m at witts end now. So PLEASE help.all the best
kamal -
IMovie newbie with problems and questions
I first posted this in iMovie 9 which was incorrect. I am at iMovie version 6.0.3.
I am new to iMovie and am struggling with my first project. My current problem is with transitions and playback. I have added a transition between my first and second clips and it shows in the clip viewer. However, when I click on the first clip and click play the clip plays to it's end but the transition does not start. If I then click on the transition and click play it goes through the transition but the next clip doesn't start to play. In fact, none of the clips play unless I click on the specific clip and click play. I would expect the entire movie to play from start to finish. Am I missing something? The iMovie Getting Started instructions are not very helpful
Thank you
JohnSorry guys (Klaus and Karsten). I didn't look thoroughly enough (most unlike me)! When the iMovie Help window appears (following the link Klaus provided), it is blank. But then I clicked on the Home button - the middle icon shaped like a house at the top left of the window. Immediately, the Help Index appeared from which I could access all the items.
How embarrassing - I should have known better, having used Help many times in the past (in all versions of iMovie).
Apologies also for my comment about Apple removing Support articles! I think baby sitting yesterday threw me off a bit
For the benefit of other users (including John Hendrie, the OP), this is the link we are talking about (as kindly provided by Klaus): http://docs.info.apple.com/article.html?path=iMovie/6.0/en/imv1096.html
John
Message was edited by: John Cogdell -
Hi,
As the subject line says, I'm a Mac newbie. I've been on a PC for about 10 years and just got my mac last Friday (how time flies!), so I'm obviously completely unfamiliar with Macs and how to mess with them.
In any case, I've kept my PC for a couple of programs that I'd like to use and need my printer for one of them. I have my printer connected to my iMac and I've networked the two computers to transfer files back and forth. So my question is this: How do I set up my computers so that I can print through my iMac from my PC? I don't want to have to rearrange the entire office just to use the printer.
Any help would be great.
Thank you!Things to check -
1. Set your Mac to be in the same Workgroup as the PC. The PC's workgroup can be found by right clicking on My Computer, select tab Computer name.
On Tiger, you set the workgroup in the Utility Directory Access - I hope Kappy can tell you where to do that on Leopard.
2. Driver - once you can find the printer in the same workgroup, when you add the printer on the PC you will need to select a postscript driver - if the printer you're trying to use is postscript, fine, its driver will work. But if the printer is a typical inkjet, you need to select some other color postscript driver on the PC, because printer queues on Macs expect to receive postscript. The Apple Color LaserWriter xx driver included on my Windows XP works well.
Hope this helps. -
Newbie with Problems with E1500
I have had an E1500 for 5 months with no problems-have Comcast internet.
After doing firmware upgrade yesterday now my download speed is only .90 mpbs and upload is 5.50 .
Speedtest with Comcast shows download speed at 35.5 - so they aren't the problem.
I did change channel from 11 to 1 and that did not help.
Just did the recycle and repowered with no help.
I did add a blu-ray player and set up Samsung hub-would that affect the router?
Thanks for any help you can give me.StevieD49 wrote:
I have had an E1500 for 5 months with no problems-have Comcast internet.
After doing firmware upgrade yesterday now my download speed is only .90 mpbs and upload is 5.50 .
Speedtest with Comcast shows download speed at 35.5 - so they aren't the problem.
I did change channel from 11 to 1 and that did not help.
Just did the recycle and repowered with no help.
I did add a blu-ray player and set up Samsung hub-would that affect the router?
Thanks for any help you can give me.
Just make sure firmware is updated if you still have the issue after following the steps provided by sabretooth. Reset and reconfigure after the update. -
Newbie : memory problem with file uploading
Hello
I'm exdending a web app based on jsf and , being new to it and java in general, i'm having a problem with file uploading.
The customer needs to upload large file (more than 30 MB). The application accomplish this using a fileupload component, to let the user select the file, and passing the array of bytes to a web service method.
I'm using netbeans 6, tomcat 5.5.
When i try to upload a file too large i got an outofmemory on the local tomcat. So i've rised jvm memory and going on with tests i've found that growing the size i got an http 500 error from the service (the developer of the service has found an out of memory too ).
I think the service is not modifiable, so i were asking if threre were a way to optimize the file uploading process (a component, a library, a pattern ...) or my only chioice is to rise available memory on both sides.
I've notice the wsdl declares as base64binary type the data parameter , while netbeans 6 generates a client proxy with a byte[] parameter. Is correct or is a netbeans problem?
searching with google i've found few thing i haven't fully understood due to my lack of experience:
the mtom , how can evaluate if it's suitable to help in my problem (i suppose it involves more the web service rather than the client)
something about the size of a soap body.
thank you in advance
StefanoWhich component exactly are you using? Declaring the stream as a raw byte[] is certainly not efficient. Write code yourself, don't let it autogenerate.
I can highly recommend you the Tomahawk t:inputFileUpload component. It is easy to integrate in Mojarra. You can find here an useful article: [http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html].
Maybe you are looking for
-
I need to restore my computer to it's factory settings but I don't want to loose my playlists and my library (windows). I can copy any file from the computer because it's in good working order. All my music it's on a external hard drive, but there's
-
Hi, I was wondering if anyone can help me with a problem I'm having. I have a Thinkpad X230i laptop which is used in a docking station. The monitor is plugged into the docking station using the VGA port. There seems to be a slight issue with the lapt
-
SQL Server 2012 Transactional Replication with updateable subscriptioins
Hi All, It is heard that Transactional Replication with Updateable Subscriptions is deprecated in SQL 2012 so it is not possible to configure through the wizards but we can still configure it by using T-SQL Script. Would you please share that script
-
Problem Reloading Info cube after Transport
I have made some changes to a cubes dimensions. Then I transported these to Test and loaded the cube there, all worked fine. Then i deleted all the data from the same cube in production before transporting it up. In production my cube was clean and r
-
Cropping 16:9 to 4:3
My source material is 1440x1080 and my sequence was automatically set to match this dimension. I need to crop the material so the final product is 4:3. The source material can be cropped without concern for the edges of the frame - I do not need to r