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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Question: How to create this function

Re: Question: How to create this function

From: Connor McDonald <mcdonald.connor.cs_at_bhp.com.au>
Date: Thu, 07 Jan 1999 16:06:12 +0800
Message-ID: <36946AF4.64AB@bhp.com.au>


Ming Liu wrote:
>
> Hi. Folks:
> I want to create a function call get_item to do the following:
> get_item('A,B,C,D', 1, ',') = 'A'
> get_item('A,B,C,D', 2, ',') = 'B'
> get_item('A,B,C,D', 3, ',') = 'C', ect.
> Thanks for any hints.

Look at INSTR function...

INSTR - Syntax INSTR(char1,char2[,n[,m]])

Purpose
Searches char1 beginning with its nth character for the mth occurrence of char2 and returns the position of the character in char1 that is the first character of this occurrence. If n is negative, Oracle7 counts and searches backward from the end of char1. The value of m must be positive. The default values of both n and m are 1, meaning Oracle7 begins searching at the first character of char1 for the first occurrence of char2. The return value is relative to the beginning of char1, regardless of the value of n, and is expressed in characters. If the search is unsuccessful (if char2 does not appear m times after the nth character of char1) the return value is 0.

--



Connor McDonald
BHP Information Technology
Perth, Western Australia
"The difference between me and a madman is that I am not mad" Received on Thu Jan 07 1999 - 02:06:12 CST

Original text of this message

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