Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

pl/sql procedure anonymous block completed with no result displayed

sqlnoobNov 12 2013 — edited Nov 12 2013

've just started learning oracle pl/sql and I'm facing some problem here.

I've no problem compiling it but whenever I execute the procedure nth would appear except the following message and not showing any output which shld not be the case: anonymous block completed

i've tried to set serveroutput on size 50000; but nth changes.

here's my pl/sql procedure not sure if i'm doing it right.

CREATE OR REPLACE PROCEDURE VERIFY AS

empnum NUMBER;

empname VARCHAR2(50);

BEGIN

select employee.e#

,      employee.name

into   empnum

,      empname

from   employee join driver on driver.e# = employee.e#

                join mechanic on mechanic.e# = driver.e#;

EXCEPTION

    WHEN NO_DATA_FOUND THEN

      DBMS_OUTPUT.PUT_LINE('ok');

END VERIFY;

/

I'm trying to achieve the same result from the following sql query:

select employee.name, employee.e#
from employee join driver
on driver.e# = employee.e#
join mechanic
on mechanic.e# = driver.e#
where rownum = 1;


so if there's any similar records it will show the employee name and num.. if there's no similar records found it will display a ok message.

This post has been answered by Karthick2003 on Nov 12 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2013
Added on Nov 12 2013
7 comments
3,587 views