By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,211 Members | 2,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,211 IT Pros & Developers. It's quick & easy.

Does ECHO work in SQLPLUS? If not what works?

P: 4
This is a SQLPLUS question. How do I display what is being executed. In other words, in the listing below what command do I need to use to see if commit will be executed. As an example, can I say:

ECHO "commit begins";

is this the right syntax for SQLPLUS?

Expand|Select|Wrap|Line Numbers
  1. declare
  2. recs number     := 0;
  3. looper number := 0;
  4. i number;
  5. begin
  6. select count(*) into recs from TTRACK where call_dt <  '1940/01/01';
  7. if recs > 0 and recs > 4 then looper := recs/5;
  8. elsif recs between 0 and 4 then looper := 1;
  9. elsif recs = 0 then
  10. return;
  11. end if;
  12.  
  13. for i in 1..looper loop
  14. DELETE FROM TTRACK WHERE rownum < 5 AND CALL_DT < '1940/01/01';
  15.  
  16. commit;
  17.  
  18. end loop;
  19.  
  20. end;
/
Sep 20 '07 #1
Share this Question
Share on Google+
1 Reply


amitpatel66
Expert 100+
P: 2,367
This is a SQLPLUS question. How do I display what is being executed. In other words, in the listing below what command do I need to use to see if commit will be executed. As an example, can I say:

ECHO "commit begins";

is this the right syntax for SQLPLUS?

*******************************************
declare
recs number := 0;
looper number := 0;
i number;
begin
select count(*) into recs from TTRACK where call_dt < '1940/01/01';
if recs > 0 and recs > 4 then looper := recs/5;
elsif recs between 0 and 4 then looper := 1;
elsif recs = 0 then
return;
end if;

for i in 1..looper loop
DELETE FROM TTRACK WHERE rownum < 5 AND CALL_DT < '1940/01/01';

commit;

end loop;

end;
/
***************************************end******** ****************
Make use of DBMS_OUTPUT.PUT_LINE in order to display any user defined message on the screen.

Before useing DBMS_OUTPUT package, you need to execute the below command:
Expand|Select|Wrap|Line Numbers
  1. SQL> SET SERVEROUTPUT ON
  2.  
Then you include the line DBMS_OUTPUT.PUT_LINE('Commit Begins') in your anonymous block
Sep 21 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.