Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Apr 14th, 2008, 1:43 PM   #1
namsu
Newbie
 
Join Date: Jan 2008
Posts: 15
Rep Power: 0 namsu is on a distinguished road
Before Insert Trigger Problem

I am making a trigger to check the whether the branch number is equal to 1 or 2, if the value is 1, it will select a table
if the value is 2, it will select a table (different to option 1).

I think the trigger should check whether the branchNo is 1, to do this i would like the trigger to check the foreign key of the order table which is called customerNo, it will then look at the customers branch using the foriegn key in the customer table which is the branchNo.

I think I am having trouble with PL-SQL syntax or maybe this is another problem that I do not know of, please can you help me.
Here is some code:
order_g.customerNo = customer_g.customerNo
and customer_g.branchNo = branch.branchNo
and location = 'Greenwich';

Here is some code of the whole trigger:

create or replace trigger os_trigger
before insert on order_g
for each row
declare
order_g.customerNo = customer_g.customerNo
and customer_g.branchNo = branch.branchNo
and location = 'Greenwich';
begin
if (:new.branchNo = 1)
then
select seq_order_g_id into :new.orderNo from dual;
else
select seq_order_e_id into :new.orderNo from dual;
end if;
end;
/

If someone can help me out that has some knowledge in this area, that would be nice. I have been searching the net, using examples and such, but I still cannot overcome the problem.
namsu is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Challenging Programming Problem - "Pinball Ranking" Sane Coder's Corner Lounge 38 Jan 15th, 2008 5:16 PM
Problem solving ReggaetonKing Software Design and Algorithms 7 Jan 4th, 2008 1:49 PM
Python calculator problem Nebula Python 14 Feb 8th, 2006 12:24 PM
problem connecting to access gencor45 Visual Basic .NET 2 May 18th, 2005 4:05 AM
string problem when passing in linked list quantz C++ 0 Feb 27th, 2005 10:11 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:49 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC