?
Solved

oracle, 10, database, using carriage return

Posted on 2008-06-17
7
Medium Priority
?
688 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 48

Expert Comment

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

Author Comment

by:rutgermons
ID: 21801942
example?
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
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 35

Accepted Solution

by:
johnsone earned 2000 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

850 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