Home » Other » Client Tools » Display output in sql (SQL *PLUS Worksheet)
Display output in sql [message #456157] Sat, 15 May 2010 06:38 Go to next message
ShinTec
Messages: 8
Registered: May 2010
Junior Member
Hello forum

having trouble displaying stuff on screen. It compiles the program successfully but just doesnt show any output Try using this (SET SERVEROUTPUT ON SIZE 4000) does nothing though. here my code
DECLARE
/*This program coverts a date from one fomat eg 1/31/10
into another format eg January 31,2010 */

/*declaring variables
assign a date that is in one format*/
EXAMPLE_DATE  DATE := TO_DATE(' 1/31/06',' MM/DD/YY' );
/*finding the position of where the forward slash are*/
position_finder NUMBER := INSTR(EXAMPLE_DATE,'/');


BEGIN
	/*Output example_date in the other format*/
	DBMS_OUTPUT.PUT_LINE(TO_CHAR(EXAMPLE_DATE));
	DBMS_OUTPUT.PUT_LINE(TO_CHAR(position_finder));
END;

any help would be much appreciated and thank you in advance
Re: Display output in sql [message #456159 is a reply to message #456157] Sat, 15 May 2010 06:44 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It works in SQL*Plus:
SQL> DECLARE
  2  /*This program coverts a date from one fomat eg 1/31/10
  3  into another format eg January 31,2010 */
  4  
  5  /*declaring variables
  6  assign a date that is in one format*/
  7  EXAMPLE_DATE  DATE := TO_DATE(' 1/31/06',' MM/DD/YY' );
  8  /*finding the position of where the forward slash are*/
  9  position_finder NUMBER := INSTR(EXAMPLE_DATE,'/');
 10  
 11  
 12  BEGIN
 13   /*Output example_date in the other format*/
 14   DBMS_OUTPUT.PUT_LINE(TO_CHAR(EXAMPLE_DATE));
 15   DBMS_OUTPUT.PUT_LINE(TO_CHAR(position_finder));
 16  END;
 17  /
31/01/2006 00:00:00
3

PL/SQL procedure successfully completed.

Note that SQL*Plus Worksheet is obsolete since many and many years.

Regards
Michel
Re: Display output in sql [message #456170 is a reply to message #456157] Sat, 15 May 2010 08:34 Go to previous message
ShinTec
Messages: 8
Registered: May 2010
Junior Member
oh tru i have to ask my teacher about it thanks
Previous Topic: cannot view 2 procedures simultaneously
Next Topic: Isqlplus connection string
Goto Forum:
  


Current Time: Thu Mar 28 09:30:14 CDT 2024