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: Oracle Newbie Question

Re: Oracle Newbie Question

From: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 08 Nov 2007 10:19:22 -0800
Message-ID: <1194545957.881478@bubbleator.drizzle.com>


CK wrote:
> Can you help me fix it?
> CREATE OR REPLACE PROCEDURE searchThis2
> (@stringToSearch varchar(255), @search varchar(1))
> IS
> BEGIN
>
> SELECT INSTR(@stringToSearch ,@search , 1,1) FROM DUAL;
>
> END;
>
> Now i get Encountered the symbol "@" when expecting one of the following
>
> Yes, T-SQL is much easier. This looks to be a bit tougher.
> Thanks for your help.
>
>
> "Brian Tkatch" <N/A> wrote in message
> news:9ug6j3ltd2lh7ou1akj19q8k52n9iub97p_at_4ax.com...

>> On Thu, 8 Nov 2007 09:02:59 -0800, "CK" <c_kettenbach_at_hotmail.com>
>> wrote:
>>
>>> Good Morning,
>>> I am from SQL Server land. I am trying to create a simple stored proc and 
>>> I
>>> can not get it right. What is wrong with this statement?
>>>
>>> CREATE OR REPLACE PROCEDURE searchThis
>>> m_stringToSearch varchar(255), m_search char(1)
>>> AS
>>> BEGIN
>>> SELECT INSTR(m_stringToSearch ,m_search , 1,1) FROM DUAL;
>>> END;
>>>
>>> I get Encountered the symbol "end-of-file" when expecting one of the
>>> following:
>>>
>>>   begin function package pragma procedure form
>>>
>>> What am I missing here?
>>> Thanks,
>>> ~ck
>>>
>> Three major errors.
>> 1) no parens around arguments
>> 2) specifying param size
>> 3) not SELECTing INTO anything
>>
>> It would probably be benficial to read the documentation. T-SQL and
>> PL/SQL are different languages, despite their similarities.
>>
>> B. 

The more you rely on Transact to guide you with Oracle the more likely you are to fail. And top posting in this group, rather than scrolling to the bottom to reply, a great way to be ignored.

CREATE OR REPLACE PROCEDURE searchThis (m_stringToSearch varchar2, m_search char(1)) AS
  x POSITIVE;
BEGIN
   SELECT INSTR(m_stringToSearch ,m_search , 1,1)    INTO x
   FROM DUAL;    dbms_output.put_line(x);
END searchThis;
/

set serveroutput on

exec serachThis;

To find working demos of correct syntax go to Morgan's Library at www.psoug.org. Study the following:

  1. Anonymous Block
  2. Function
  3. Stored Procedures -- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.org
Received on Thu Nov 08 2007 - 12:19:22 CST

Original text of this message

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