![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Jan 2008
Posts: 15
Rep Power: 0
![]() |
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. |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |