Home » SQL & PL/SQL » SQL & PL/SQL » anonymous block completed (Oracle PL/SQl)
anonymous block completed [message #505105] Fri, 29 April 2011 07:47 Go to next message
pverma
Messages: 16
Registered: August 2010
Junior Member
Hi Guru,

I am trying to run the following script but some how i am getting message: anonymous block completed. Please advise me where i am doing wrong and also please advise me how can i display the values with their column names.

set serveroutput on size 1000000
Declare
     v_pr_nbr    document.document_nbr%type:= ' ' ;

cursor c1 is 
SELECT pr.document_dt,
       pr.status_cd,
       pr.document_nbr PR_Number,
       da.document_nbr_dsp Award_Document_Nbr,
       fi.fi_trans_amount,
       decode (fi.fi_trans_type_cd, 9, 'Closeout', 5, 'Obligated', 'Not Obligated') trans_type,
       vfs.fi_trans_status_message,
       fi.fi_trans_post_dt,
       decode (fi.fi_trans_status_cd, 2, 'Y', 'N') success
from document pr,
     proc_doc_related p,
     document da,
     fi_trans_status fi,
     Val_fi_trans_type vft,
     val_fi_Trans_status vfs
where PR.OBJECT_TYPE_CD = 'PR' and
      pr.document_dt >= 20071001 and 
      pr.document_dt <= 20110930 and
      p.pr_objct_id = pr.object_id and
      da.object_id = p.awd_objct_id and
      fi.object_id(+) = p.awd_objct_id and
      vft.fi_trans_type_cd(+) = fi.fi_trans_type_cd and
      vfs.fi_trans_status_cd(+) = fi.fi_trans_status_cd
      order by PR_Number;
begin
     for v_rec in c1 
      loop
      
      if  v_pr_nbr != v_rec.PR_Number then
     
     dbms_output.put_line( 'Document_dt'||v_rec.document_dt);
          
       v_pr_nbr:=v_rec.PR_NUMBER ;
   end if;
   end loop; 
   end;
/


Thanks in advace.


[mod-edit: code tags added by bb; next time please add them yourself]

[Updated on: Fri, 29 April 2011 14:10] by Moderator

Report message to a moderator

Re: anonymous block completed [message #505107 is a reply to message #505105] Fri, 29 April 2011 07:50 Go to previous messageGo to next message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
If that's all you're getting then your code executed at written.

Where the server output goes depends entirely on your tool.

[Updated on: Fri, 29 April 2011 07:51]

Report message to a moderator

Re: anonymous block completed [message #505109 is a reply to message #505105] Fri, 29 April 2011 07:55 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
i am getting message: anonymous block completed

What did you expect? If it was the result of DBMS_OUTPUT.PUT_LINE (but it never appeared), it means that IF condition was not met.
Re: anonymous block completed [message #505110 is a reply to message #505105] Fri, 29 April 2011 08:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68757
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals, and Use SQL*Plus and copy and paste your session, the WHOLE session that show us what you do and get.

Regards
Michel
Re: anonymous block completed [message #505133 is a reply to message #505105] Fri, 29 April 2011 11:24 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
What tool are you using, since "anonymous block completed" is not an Oracle message that I have ever seen in SQL*Plus.

Also, if your fields and columns ending in NBR/NUMBER are truly numbers, then your first declaration is invalid.
Re: anonymous block completed [message #505204 is a reply to message #505133] Sat, 30 April 2011 05:55 Go to previous messageGo to next message
cookiemonster
Messages: 13966
Registered: September 2008
Location: Rainy Manchester
Senior Member
It's also possible that the cursor isn't finding any data.
Re: anonymous block completed [message #505295 is a reply to message #505204] Mon, 02 May 2011 02:34 Go to previous messageGo to next message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
@Joy_division

SQL Developer shows that when you run unstored pl/sql, don't know about other tools.
Re: anonymous block completed [message #505326 is a reply to message #505295] Mon, 02 May 2011 08:09 Go to previous message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Roachcoach wrote on Mon, 02 May 2011 03:34
@Joy_division

SQL Developer shows that when you run unstored pl/sql, don't know about other tools.


Thanks Roachcoach.
Previous Topic: Unable to Query Table
Next Topic: Execution completed with warning
Goto Forum:
  


Current Time: Sun Apr 27 01:21:21 CDT 2025