Home » SQL & PL/SQL » SQL & PL/SQL » Print Sentence Vertically
Print Sentence Vertically [message #357902] Fri, 07 November 2008 02:42 Go to next message
fairgame
Messages: 29
Registered: October 2008
Junior Member
Hi Team,

Like,
select SUBSTR('ORACLE',rownum,1)T from all_objects where rownum<=LENGTH('ORACLE')

T
--
O
R
A
C
L
E


how can i get this, using SQL
String: 'ORAFAQ ORACLE FORUM'
Column
------
ORAFAQ
ORACLE
FORUM
Re: Print Sentence Vertically [message #357903 is a reply to message #357902] Fri, 07 November 2008 02:46 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> col c format a7
SQL> select 'ORAFAQ ORACLE FORUM' c from dual;
C
-------
ORAFAQ
ORACLE
FORUM

1 row selected.

Regars
Michel
Re: Print Sentence Vertically [message #357913 is a reply to message #357902] Fri, 07 November 2008 03:39 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

SQL> select replace('ORAFAQ ORACLE FORUM',' ',chr(10)) str from dual;

STR
-------------------
ORAFAQ
ORACLE
FORUM


SQL>


Smile
Rajuvan.

[Updated on: Fri, 07 November 2008 03:41]

Report message to a moderator

Re: Print Sentence Vertically [message #357984 is a reply to message #357913] Fri, 07 November 2008 08:29 Go to previous messageGo to next message
fairgame
Messages: 29
Registered: October 2008
Junior Member
The above solutions works in SQL*PLUS, how about running in Oracle SQL Developer or TOAD.
Re: Print Sentence Vertically [message #357986 is a reply to message #357984] Fri, 07 November 2008 08:48 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Just take your original solution, and instead of simply stking the next character, use INSTR to find the location of the next space in the string, and get the word that way.

Previous Topic: CUSROR%FOUND
Next Topic: Optimization.
Goto Forum:
  


Current Time: Sat Dec 03 12:25:14 CST 2016

Total time taken to generate the page: 0.10180 seconds