Question

Asked:
Asked By:
Aug 21 2008   8:06 PM GMT
CAGIRL   5 pts.

How to parse a string


Oracle

Hi, I have a file name that has multiple nodes, I want to get the file extension after the last '.'.
How do I do this?

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0



Use INSTR

DECLARE
v_pos NUMBER;
v_string VARCHAR2(20) := 'abc.123.txt';
v_file_type VARCHAR2(20);
BEGIN
v_pos := INSTR(v_string, '.', -1);
v_file_type := SUBSTR(v_string, v_pos + 1);
DBMS_OUTPUT.PUT_LINE(v_file_type);
END;
/
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Oracle.

Looking for relevant Oracle Whitepapers? Visit the SearchOracle.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register