Home » SQL & PL/SQL » SQL & PL/SQL » How to debug in SqlPlus ( .sql file )
How to debug in SqlPlus ( .sql file ) [message #197855] Thu, 12 October 2006 23:16 Go to next message
hoa_lan_trang1982
Messages: 4
Registered: October 2006
Junior Member
Hi all!
Anyone here can tell me how to debug in SqlPlus such as print a variable in a file has .sql extension.
Thanks a lot!
Re: How to debug in SqlPlus ( .sql file ) [message #197864 is a reply to message #197855] Fri, 13 October 2006 00:09 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Using DBMS_OUTPUT.PUT_LINE would be one option (don't forget to SET SERVEROUTPUT ON before running the code). Another one would be use of DBMS_DEBUG utility.
Re: How to debug in SqlPlus ( .sql file ) [message #197894 is a reply to message #197855] Fri, 13 October 2006 03:06 Go to previous messageGo to next message
hoa_lan_trang1982
Messages: 4
Registered: October 2006
Junior Member
I have a .sql file like this:


declare
fs_cnt number := 0;

begin
select count(*) into fs_cnt from TB_FSDTL;
end
--When I execute this file, I want to print the value of fs_cnt variable. What line of code must I put here to print this value?


Thanks!
Re: How to debug in SqlPlus ( .sql file ) [message #197896 is a reply to message #197894] Fri, 13 October 2006 03:12 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Once again:

Using DBMS_OUTPUT.PUT_LINE would be one option (don't forget to SET SERVEROUTPUT ON before running the code).
Re: How to debug in SqlPlus ( .sql file ) [message #197957 is a reply to message #197894] Fri, 13 October 2006 07:57 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
And don't forget to put a semicolon at the end of the end statement you have.
Re: How to debug in SqlPlus ( .sql file ) [message #197996 is a reply to message #197957] Fri, 13 October 2006 13:03 Go to previous message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
And a slash (/) sign into the next line in order to run this PL/SQL procedure. http://www.orafaq.com/forum/fa/1601/0/
Previous Topic: GRANTING PROBLEM ,TELL ME THE CORRECT SYNTAX.WITH EXAMPLE
Next Topic: Multiple Outer Joins
Goto Forum:
  


Current Time: Sat Dec 03 05:39:42 CST 2016

Total time taken to generate the page: 0.12512 seconds