Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Stored Proc help
On Thu, 8 Nov 2007 11:13:19 -0800, "CK" <c_kettenbach_at_hotmail.com>
wrote:
>This is failing. I got the sql to work but when i put it in a proc I am
>having a little trouble. Any ideas?
>
>CREATE OR REPLACE PROCEDURE searchThis
> (m_stringToSearch varchar, m_search char, result out integer)
>AS
>BEGIN
>DECLARE position integer :=1;
>WHILE position <= length(m_stringToSearch)
> LOOP
> SELECT INSTR(m_stringToSearch, m_search, position, 1) INTO result FROM
>DUAL;
> dbms_output.put_line(result);
> IF result > 0 THEN
> position := result + 1;
> ELSE
> position := length(m_stringToSearch) + 1;
> END IF;
> END LOOP;
>END;
>
>I get
>ERROR at line 8: PLS-00103: Encountered the symbol "=" when expecting one of
>the following:
>
> := . ( @ % ; not null range default character
>6. BEGIN
>7. DECLARE position integer :=1;
>8. WHILE position <= length(m_stringToSearch)
>9. LOOP
>10. SELECT INSTR(m_stringToSearch, m_search, position, 1) INTO result
>FROM DUAL;
>
>Any ideas? Thanks!
>~ck
>
Procedures and functions standalone and in packages don't need the
declare keyword.
declarations are before the first begin.
-- Sybrand Bakker Senior Oracle DBAReceived on Thu Nov 08 2007 - 16:47:52 CST
![]() |
![]() |