Results 1 to 6 of 6

Thread: Help needed

  1. #1
    Join Date
    Jul 2013
    Posts
    3

    Unanswered: Help needed

    Hi to all

    am new in this forum & new to plsql. i wish to become a plsql developer.i wish you people help me for this.
    Today i installed Oracle 11gR2 and sql Developer.i write a simple pgm.the pgm was successfully complied but i cant see the output in results.
    Is there any mistakes in my code Or is there any changes in developer tool to see the results.

    declare
    row_count number(5);
    begin
    update employees
    set salary= salary+100 where employee_id >150;
    if sql%notfound then
    dbms_output.put_line('No records updated');
    elsif sql%found then
    row_count := sql%rowcount;
    dbms_output.put_line('number of updated employees are'||row_count);
    end if;
    exception
    when no_data_found then
    dbms_output.put_line('No records in this range');
    end;


    Thanks in Advance
    Pravi

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Try executing this command before your script:
    Code:
     SET SERVEROUT ON SIZE 1000000;
    Or add to your procedure:
    Code:
    DECLARE
      row_count   NUMBER (5);
    BEGIN
      DBMS_OUTPUT.enable ( 1000000);
    
      UPDATE employees
         SET salary   = salary + 100
       WHERE employee_id > 150;
    
      IF SQL%NOTFOUND
      THEN
        DBMS_OUTPUT.put_line ( 'No records updated');
      ELSIF SQL%FOUND
      THEN
        row_count   := SQL%ROWCOUNT;
        DBMS_OUTPUT.put_line ( 'number of updated employees are' || row_count);
      END IF;
    EXCEPTION
      WHEN NO_DATA_FOUND
      THEN
        DBMS_OUTPUT.put_line ( 'No records in this range');
    END;
    /
    Last edited by LKBrwn_DBA; 07-17-13 at 16:29.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Jul 2013
    Posts
    3
    Thanks for the reply

    i tried the both suggestions.but there is no output.
    when i execute the statement there is nothing in result window.when press on "run script" it shows anonymous block completed.

    is there any mistakes in my code?


    Thanks

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    You need to enable serveroutput in a tool you use. LKBrwn_DBA told you how to do that in SQL*Plus. Your tool is SQL Developer, isn't it? Therefore, click a big green + button in the DBMS Output window and you should see the result of your code in there.

  5. #5
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Quote Originally Posted by link2pravi View Post
    Thanks for the reply

    i tried the both suggestions.but there is no output.
    when i execute the statement there is nothing in result window.when press on "run script" it shows anonymous block completed.

    is there any mistakes in my code?

    Thanks
    No mistakes in your code, except maybe the "EXCEPTION" section will never get to execute.

    Are you using TOAD? Then click on the "DBMS Output" tab and click on "Turn Output On" button

    If you are using SQL Developer:
    • Click on to menu: View -> DBMS Output
    • DBMS Output tab will appear, click on plus (+) sign to select connection
    • Run your script.

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  6. #6
    Join Date
    Jul 2013
    Posts
    3
    Yes.it works.
    Thank you for your information

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •