Home » SQL & PL/SQL » SQL & PL/SQL » Data output formatted (10g.)
Data output formatted [message #362847] Thu, 04 December 2008 05:13 Go to next message
J1357
Messages: 33
Registered: November 2008
Member

Data is like M1_[M2]-[[M3]]+[M4]
Now i want the data which will remove all the brackets from one string
Output to be M1 M2 M3 M4 imean all the no of [ which can be of any no like [M1].[[[M2]]]+[M3]_M21
Output would now be M1 M2 M3 M21...like wise

Logic needs to take the innermost brackets to be coverted to strings.
Also, the M1 may be "M1_23+-" which may have special characters.
The data output has to be intact what-ever the data may have.

Any ideas ...Gurus Sad
Re: Data output formatted [message #362850 is a reply to message #362847] Thu, 04 December 2008 05:27 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Michel Cadot wrote on Tue, 25 November 2008 00:44
From your previous topic:
Michel Cadot wrote on Wed, 19 November 2008 14:44
Thanks for posting sample data but we can't with. Posting a test case is posting create table and insert statements along with the result you want with the data you provide.

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and use code tags.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel




Except that this time you did not post a test case.

What about using TRANSLATE?
Re: Data output formatted [message #362864 is a reply to message #362847] Thu, 04 December 2008 06:10 Go to previous messageGo to next message
rajy_salim
Messages: 204
Registered: January 2008
Location: Beirut - Lebanon
Senior Member
Or REPLACE

Rajy
Re: Data output formatted [message #362876 is a reply to message #362847] Thu, 04 December 2008 06:35 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I've no idea what this means
Logic needs to take the innermost brackets to be coverted to strings.
Also, the M1 may be "M1_23+-" which may have special characters.
The data output has to be intact what-ever the data may have. 
, or what effect it would have on your desired output, which you haven't given in anywhee near enough detail:

This does something like what you have asked for:
with src as (select 'M1_[M2]-[url=/wiki/M3]M3[/url]+[M4]' col_1 from dual union all
              select '[M1].[[url=/wiki/M2]M2[/url]]+[M3]_M21' from dual)
select col_1,regexp_replace(col_1,'[^M0-9]+',' ')
from src;
Re: Data output formatted [message #362882 is a reply to message #362847] Thu, 04 December 2008 06:57 Go to previous messageGo to next message
J1357
Messages: 33
Registered: November 2008
Member
What i meant was that the data which is to be brought inside the inner most bracket may be numeric ,alphanumeric or even special characters data.

Hope picture is more clearer.

Thanks for your inputs ...
Re: Data output formatted [message #362887 is a reply to message #362882] Thu, 04 December 2008 07:09 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Hardly any clearer at all.

I have no real idea whether you are trying to strip the brackets and other symbols out of the string, or whether you are trying to perform some calculations.

Please give us a clear description of what yuo are trying to do, with enough examples that someone who knows nothing about what you are trying to do could be reasonably expected to understand the problem
Previous Topic: ORA-00972: identifier is too long while using DBMS_SQLTUNE
Next Topic: Data filtering
Goto Forum:
  


Current Time: Wed Dec 11 23:42:38 CST 2024