DBMS_OUTPUT.PUT_LINE not printing
Set Query as below at first line
SET SERVEROUTPUT ON
What is "it" in the statement "it just says the procedure is completed"?
By default, most tools do not configure a buffer for dbms_output
to write to and do not attempt to read from that buffer after code executes. Most tools, on the other hand, have the ability to do so. In SQL*Plus, you'd need to use the command set serveroutput on [size N|unlimited]
. So you'd do something like
SQL> set serveroutput on size 30000;
SQL> exec print_actor_quotes( <<some value>> );
In SQL Developer, you'd go to View | DBMS Output
to enable the DBMS Output window, then push the green plus icon to enable DBMS Output for a particular session.
Additionally, assuming that you don't want to print the literal "a.firstNamea.lastName" for every row, you probably want
FOR row IN quote_recs
LOOP
DBMS_OUTPUT.PUT_LINE( row.firstName || ' ' || row.lastName );
END LOOP;
this statement
DBMS_OUTPUT.PUT_LINE('a.firstName' || 'a.lastName');
means to print the string as it is.. remove the quotes to get the values to be printed.So the correct syntax is
DBMS_OUTPUT.PUT_LINE(a.firstName || a.lastName);
- Ensure that you have your Dbms Output window open through the view option in the menubar.
- Click on the green '+' sign and add your database name.
- Write 'DBMS_OUTPUT.ENABLE;' within your procedure as the first line. Hope this solves your problem.