Display result in PL/SQL

begin
coll.countStudent();
end;


The procedure countStudent contains sql that display the result of the query.
But I only get this message:
PL/SQL complete successfully

How to get the output? I have tried using
set serveroutput on

but still get the same result
scissorhandAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

montonenCommented:
Hi.

If you want output from a PL/SQL procedure...
use:

DBMS_OUTPUT.PUT_LINE('TEXT GOES HERE' || sSomeVariable);

Do this while looping thrue the cursor for the SELECT statment.

Normally you don't want output from PL/SQL... except form return values. DBMS... is good for debugging though.

Regards
Jonas Montonen
GliuckCommented:
You must have the SERVEROUTPUT variable set to ON to see the output.

Set it to OFF to stop the SP from displaying output.
MergenCommented:
hi
If you call your procedure from SqlPlus(Worksheet), you should set variable
set serveroutput on;
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

scissorhandAuthor Commented:
Sorry to tell u that I use a telnet to connect to my college server. I have on serveroutput but still can not
scissorhandAuthor Commented:
Also this procedure is created using java and register it to the system. I use system.out.println
scissorhandAuthor Commented:
Also this procedure is created using java and register it to the system. I use system.out.println
SDuttaCommented:
You have to SET serveroutput ON and also call dbms_java.set_output with the output buffersize.

Here is an example :

1) Create the java source file JavaProc.java
class JavaProc {
 public static void main(String[] arg_in) {
    system.out.println("Your input is : " + arg_in[0]);
  }
}

2) Load the .java file into the database.
$> loadjava -u scott/tiger JavaProc.java

3) Publish the Java code to PL/SQL by creating the PL/SQL wrapper.
CREATE OR REPLACE PROCEDURE javaproc(cmd VARCHAR2)
AS LANGUAGE JAVA
name 'JavaProc.main(java.lang.String[])';
/

4) Call the procedure.
SQL> set serveroutput on
Server Output                   ON
SQL> call dbms_java.set_output(2000);
Statement processed.
SQL> exec JavaProc('How are you ?');
Statement processed.
Your input is : How are you ?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
scissorhandAuthor Commented:
Thanx for your help. I just need a statement to complete my work
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.