Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Oracle/PLSQL: Extract the directory path from a fu

Author  Topic 

binita007
Starting Member

2 Posts

Posted - 2010-12-16 : 02:29:09
Hi friends,

I have a string that contains the full path to a file. How can I extract the directory path from the string in Oracle?

For example, if I have a full file path as follows:

'c:\windows\temp\example.xls'

I want to retrieve the following:

'c:\windows\temp'

Thanks in advance.

Devart
Posting Yak Master

102 Posts

Posted - 2010-12-16 : 02:59:43
Hello,

For example:

select
SUBSTR('c:\windows\temp\example.xls',1,LENGTH('c:\windows\temp\example.xls')-REGEXP_INSTR(replace(reverse('c:\windows\temp\example.xls'),'\','~*~'),'~*~'))
from dual;

Devart,
SQL Server Tools:
dbForge Schema Compare
dbForge Data Compare
dbForge Query Builder
Go to Top of Page

binita007
Starting Member

2 Posts

Posted - 2010-12-16 : 03:20:20
Thanks.
Go to Top of Page
   

- Advertisement -