dbTalk Databases Forums  

help with database

comp.database.oracle comp.database.oracle


Discuss help with database in the comp.database.oracle forum.



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

Default help with database - 04-18-2006 , 02:33 PM






I'm using Oracle as my database, and Dreamweaver to create the input forms.
I need to be able to pass a value that is created automaticlly by the
database via the use of a trigger. Everything works fine when the first user
inputs his/her data, but then I get an error message after that.

Here is the trigger:
create or replace trigger wine_cust_trigger
before insert on wines
for each ro
begin
select customer_id into :new.customer_id from customer ;
end ;
/

Here is the error message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Oracle][ODBC][Ora]ORA-01422: exact fetch returns more than requested number
of rows ORA-06512: at "LTRAUB.WINE_CUST_TRIGGER", line 2 ORA-04088: error
during execution of trigger 'LTRAUB.WINE_CUST_TRIGGER'
/phoenix/wines.asp, line 115

Any help would be appreciated.

Thanks.



Reply With Quote
  #2  
Old   
Jim Kennedy
 
Posts: n/a

Default Re: help with database - 04-18-2006 , 09:51 PM







"TekDragon" <TekDragon (AT) hm (DOT) com> wrote

Quote:
I'm using Oracle as my database, and Dreamweaver to create the input
forms.
I need to be able to pass a value that is created automaticlly by the
database via the use of a trigger. Everything works fine when the first
user
inputs his/her data, but then I get an error message after that.

Here is the trigger:
create or replace trigger wine_cust_trigger
before insert on wines
for each ro
begin
select customer_id into :new.customer_id from customer ;
end ;
/

Here is the error message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Oracle][ODBC][Ora]ORA-01422: exact fetch returns more than requested
number
of rows ORA-06512: at "LTRAUB.WINE_CUST_TRIGGER", line 2 ORA-04088: error
during execution of trigger 'LTRAUB.WINE_CUST_TRIGGER'
/phoenix/wines.asp, line 115

Any help would be appreciated.

Thanks.


I bet if you do
select customer_id from customer;
You will get a list of customer_ids. You can't put multiple customer_id's
into a scalar value. That is also what the Oracle error is telling you
"ORA-01422: exact fetch returns more than requested number
of rows ". I think you have limit the customer table so you choose the
correct customer.
Jim




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.