dbTalk Databases Forums  

stored procedure

comp.databases.oracle.tools comp.databases.oracle.tools


Discuss stored procedure in the comp.databases.oracle.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
indianhuny
 
Posts: n/a

Default stored procedure - 04-29-2006 , 01:04 PM






Hi everyone,
I'm new to this and I need some help with stored procedures. i'm
using oracle 9i and would like to create a stored procedure to enter an

order in the ORDER table and find out if this is the 10th order for the

customer. The procedure receives all the information in the CUSTOMER,
SERVICE and ORDER_ITEM tables. If the customer exists in the database,

use the existing customer data and check if this is the 10th order for
the customer, if yes give a 50% discount on that order. Otherwise,
create a new row in CUSTOMER. Create the new ORDER and ORDER_ITEM
rows.

Thanx in advance for any help i can get on this.


-K-


Reply With Quote
  #2  
Old   
DA Morgan
 
Posts: n/a

Default Re: stored procedure - 05-01-2006 , 04:13 PM






indianhuny wrote:
Quote:
Hi everyone,
I'm new to this and I need some help with stored procedures. i'm
using oracle 9i and would like to create a stored procedure to enter an

order in the ORDER table and find out if this is the 10th order for the

customer. The procedure receives all the information in the CUSTOMER,
SERVICE and ORDER_ITEM tables. If the customer exists in the database,

use the existing customer data and check if this is the 10th order for
the customer, if yes give a 50% discount on that order. Otherwise,
create a new row in CUSTOMER. Create the new ORDER and ORDER_ITEM
rows.

Thanx in advance for any help i can get on this.


-K-
What help do you want? Are you interested in hiring a consultant to
do you work for you or just for someone to provide general guidance?

Daniel Morgan
www.psoug.org


Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: stored procedure - 05-01-2006 , 05:53 PM



indianhuny (kesha_mehta83 (AT) hotmail (DOT) com) wrote:
: Hi everyone,
: I'm new to this and I need some help with stored procedures. i'm
: using oracle 9i and would like to create a stored procedure

perhaps

create or replace package
create or replace package body

: to enter an
: order in the ORDER table

-- one way might be
SQLPLUS> exec my_pkg.enter_order('example','data');

: and find out if this is the 10th order for the
: customer. The procedure receives all the information in the CUSTOMER,
: SERVICE and ORDER_ITEM tables. If the customer exists in the database,

Sounds like typical programming logic. PL/SQL has numerous constructs
such as IF THEN ELSE that might help, and it integrates easily with SQL to
provide access to commands like SELECT (which can make use of the ever
useful EXISTS).

: if yes give a 50% discount on that order.

maybe somthing like

amount := amount * discount;


(etc etc etc)


Reply With Quote
  #4  
Old   
indianhuny
 
Posts: n/a

Default Re: stored procedure - 05-01-2006 , 07:57 PM



thank u...this makes sense


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.