Solved

oracle, 10, database, using carriage return

Posted on 2008-06-17
7
679 Views
Last Modified: 2013-12-18
folks,how can i use oracle to define a carriage return of a date field

my field is reportdate  13-06-2008 14:25:02 and i want the field to display

reportdate
13-06-2008
14:25:02

im hesitant of it working but all help will do

r
0
Comment
Question by:rutgermons
7 Comments
 
LVL 16

Expert Comment

by:Milleniumaire
ID: 21801457
It depends which tool you are using to display the output.

The following characters will display a newline on a unix system:

chr(13)||chr(10)

For example:

declare
  newline varchar2(2) := chr(13)||chr(10);
begin
  dbms_output.put_line('Line1'||newline||'Line2');
end;
/
0
 
LVL 47

Expert Comment

by:schwertner
ID: 21801775
CHR(10) is enough!
0
 

Author Comment

by:rutgermons
ID: 21801942
example?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 16

Expert Comment

by:Milleniumaire
ID: 21801970
Dug the example out of some code.  Not sure why they use chr 13 and 10, but chr 10 is enough to give a newline as follows:
declare
  newline varchar2(1) := chr(10);
begin
  dbms_output.put_line('Line1'||newline||'Line2');
end;
/
0
 

Author Comment

by:rutgermons
ID: 21802111
how do i dump this into a select type query according to my intial question?
0
 
LVL 34

Accepted Solution

by:
johnsone earned 500 total points
ID: 21802438
select to_char(sysdate, 'dd-mm-yyyy') || chr(10) || to_date(sysdate, 'hh24:mi:ss');
0
 
LVL 16

Expert Comment

by:Milleniumaire
ID: 21802593
Or, to ensure you get the required heading:

select to_char(reportdate, 'dd-mm-yyyy') || chr(10) || to_date(reportdate, 'hh24:mi:ss') reportdate
from yourtable;
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now