Solved

oracle, 10, database, using carriage return

Posted on 2008-06-17
7
683 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to take different types of Oracle backups using RMAN.

732 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