Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Substr and remove characters from field

Re: Substr and remove characters from field

From: LKBrwn_DBA <member30625_at_dbforums.com>
Date: Wed, 23 Jul 2003 21:30:01 +0000
Message-ID: <3145093.1058995801@dbforums.com>

The statements work for any number of slashes:

SQL>set serveroutput on size 1000000;
SQL>
SQL>Accept dir prompt 'Directory name? '
Directory name? c:\test\hello\people\file.tif SQL>
SQL>declare
  2 v_path varchar2(128):='';
  3 v_filenm varchar2(64):='';
  4 begin
  5   v_path:=substr('&&dir',1,instr('&&dir','\',-1));
  6   V_filenm:=substr('&&dir',instr('&&dir','\',-1)+1);
  7   v_filenm:=substr(v_filenm,1,instr(v_filenm,'.',-1)-1);
  8 dbms_output.put_line('Path is: '||v_path);   9 dbms_output.put_line('File name is: '||v_filenm);  10 end;
 11 /
Path is: c:\test\hello\people\
File name is: file
SQL>
--
Posted via http://dbforums.com
Received on Wed Jul 23 2003 - 16:30:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US