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 procedure newbie

Re: oracle procedure newbie

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 04 Jul 2006 09:16:33 -0700
Message-ID: <1152029797.931794@bubbleator.drizzle.com>


Bulldog wrote:
> CREATE PROCEDURE DISPLAY_PRODUCT @PRODUCT_CODE VARCHAR(5)
> AS
> BEGIN
> IF NOT EXITS(SELECT 1 FROM CIS269_PRODUCT WHERE
> PRODUCT_CODE=@PRODUCT_CODE)
> BEGINRAISEERROR('NO DATA FOUND.',16,1)
> RETURN1
> END
If you want help DO NOT top post.

The solution is simply to learn Oracle syntax and not either attempt to clone it from some other company's product or invent it on your own. There is essentially nothing in what you've written that is valid in Oracle.

Lets start at the beginning:

CREATE OR REPLACE not CREATE ... (minor) No "IN" parameters ... (totally invalid given what you are doing) VARCHAR(5) ... (totally invalid)
@PRODUCT_CODE ... (totally invalid)
BEGINRAISEEERROR ... (totally invalid in all database products) no end to the "IF" statement ... (totally invalid) END ... (lacking semicolon and forward slash)

If you are really working in Oracle, which I am inclined to doubt, go to Morgan's Library at www.psoug.org and click on Procedures. There you will find working demos that you can learn from and modify.

-- 
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 Tue Jul 04 2006 - 11:16:33 CDT

Original text of this message

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