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: Problem with INSTR and SUBSTR ???

Re: Problem with INSTR and SUBSTR ???

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sun, 20 Jun 1999 13:44:48 GMT
Message-ID: <376cf03e.1538632@newshost.us.oracle.com>


A copy of this was sent to "Chow Hoi Ka, Eric" <d951686_at_sftw.umac.mo> (if that email address didn't require changing) On Sat, 19 Jun 1999 17:16:55 +0800, you wrote:

>Hello,
>
>SELECT lastname, INSTR(lastname, 'O', 2, 1) from data;
>
>The above query can work well.
>
>But, is it possible to use INSTR not with a query ?
>
>For instance,
>
>declare
> str0 varchar2(30);
>begin
> str0 := INSTR('abcdefghi', 'cd', 1, 1);
>end;
>
>I tried the above statements, it seems that INSTR in that situation
>can't work.
>

why not?

SQL> set serveroutput on
SQL> l
  1 declare
  2 str0 varchar2(30);
  3 begin

  4      str0 := INSTR('abcdefghi', 'cd', 1, 1);
  5     dbms_output.put_line( str0 );

  6* end;
SQL> /
3

PL/SQL procedure successfully completed.

I just ran it -- works just fine (same with substr)...

>So, if I want to use INSTR or SUBSTR in a store procedure but not in a
>query,
>how to do it ?
>
>Would you please to give me a simple example ???
>
>Best regards,
>Eric

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Fine Grained Access Control", added June 8'th  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Sun Jun 20 1999 - 08:44:48 CDT

Original text of this message

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