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
Solved

Extracting Part Of SQL Output

Posted on 2009-07-07
3
234 Views
Last Modified: 2013-12-19
Hello,

The displayed SQL will output the below entry:

LOCATION=c:\oradata\DB1\recovery1

Q:
How can I just output everything to the right of the equals sign?

Desired output:  c:\oradata\DB1\recovery1

Thanks,

Michael

SELECT value 
FROM v$parameter 
WHERE name='log_archive_dest_1';

Open in new window

0
Comment
Question by:michael4606
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
Andytw earned 450 total points
ID: 24793523
This should do it:
SELECT SUBSTR(value, INSTR(value,'=') + 1 )
FROM v$parameter 
WHERE name='log_archive_dest_1';

Open in new window

0
 
LVL 11

Assisted Solution

by:Andytw
Andytw earned 450 total points
ID: 24793789
Just as a follow-up.  I see you're looking at the parameter log_archive_dest_n.  The format of this parameter doesn't necessarily *just* contain LOCATION="????", it consists of name/value pairs. So the value of this parameter could be, for example, 'LOCATION="e:\test\" OPTIONAL REOPEN=10.

In which case, something a bit more advanced is needed which can strip out just the location, if that's all you're interested in ...
SELECT regexp_replace(value,'LOCATION=(.+? ).*', '\1', 1,0,'i')
FROM v$parameter 
WHERE name='log_archive_dest_1';

Open in new window

0
 
LVL 32

Assisted Solution

by:awking00
awking00 earned 50 total points
ID: 24794544
Not sure what you intend to do with that result, but note that the value can also be null, so you may want to wrap an "nvl(...,default_destination_path) around Andytw's regular expression query.
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
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
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

856 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