2
CREATE OR REPLACE PROCEDURE TEST_PROC
IS
  str varchar(100);
  rec_count INTEGER;

BEGIN
    str := 'select count(*) from emp_record';
    EXECUTE IMMEDIATE str into rec_count;
    dbms_output.put_line(rec_count);
END;

I can see output of this procedure in Toad(for oracle), but when i execute this in command line via sqlplus i see following output

SQL> exec test_proc;

PL/SQL procedure successfully completed.

so question is how can i see count output on command line.

abidkhan303
  • 1,761
  • 3
  • 18
  • 31

1 Answers1

3

You need to enable the output in SQL/PLUS before running your stored procedure:

SET SERVEROUTPUT ON
Frank Schmitt
  • 30,195
  • 12
  • 73
  • 107