473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to solve stock calculation Error?

Hello
I have to two tables as following
-----------------------------
create table orders
(orderid number primary key,
orderdate date,Ename varcarh2(20),
ItemID number,ItemName varchar2(20),
Itemtype varchar2(20),tons number);
sql>table created

create table companystock
(Itemid number,ItemName varchar2(20),
Itemtype varchar2(20),tons number);
sql>table created
-----------------------------
when i create primary key on companystock.itemid
reference it to orders.itemid then
in the form6i I create abutton by the name of Save Record
and i do the following code for the button
WHEN-BUTTON-PRESS trigger
----------------------------
begin
if nvl(:orders.itemid,0)=:companystock.itemid then
update companystock set tons=tons+nvl(:orders.tons,0)
where itemid=:orders.itemid;
ELSIF nvl(:orders.itemid,0)<>:companystock.itemid then
insert into companystock(itemid,itemName,itemtype,tons)
values
(:orders.itemid,:orders.:itemname,:orders.:itemtyp e,:orders.tons);
commit_form;
go_block('orders');
execute_query;
end if;
exception when others then
message('Record Not Saved Successfull');
end;
--------------------------------
it insert record but it not update the record;
if i remove the primary key from companystock.itemid then
it insert duplicate record into companystock.
PLZ give me the best passible way to solve the problem.

Looking forword.
thank u in advance.
Nov 25 '10 #1

✓ answered by Jaydeep Paul

commit_form; is local for elsif block. In the if block it is doing the task but not getting commited.

1 1486
commit_form; is local for elsif block. In the if block it is doing the task but not getting commited.
Nov 29 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: vg-mail | last post by:
Hello all, I have identical design for form and report but I am getting calculation error on form and everything is OK on report. The form and report are build up on SQL statement. The...
1
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. ...
4
by: namalapavan | last post by:
hii , i am getting and error while installing oracle9i on RHEL AS 4.0 .i am sure that somebody here would be able to solve my problem.kindly reply so that i can send you the detailed error report....
3
by: jx2 | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>game</title> <script language='javascript'><!-- ...
12
Lazandra
by: Lazandra | last post by:
Hi all I have a bit of javascript code that is ment to add products together. This is a form and it works fine on its own. However when i integrate it into my php script it brings up this error...
2
by: Dameon Vanscyoc | last post by:
mile1smin=mile1min; mile1ssec=mile1sec; mile1shun=mile1hun; //first set of hundreds mile1sminsec=mile1smin*60; mile1sminsechun=mile1sminsec*100;...
40
by: sazd1 | last post by:
Hi Student2 I am working on similar kind of thing for stock calculation but could not find any solution to my problem even after putting my problem to different forums. I saw your post that you...
1
by: brboga | last post by:
Hello, VBA gives an error on the indicated line. "tblparameters" is a database which exists. Option Compare Database Option Explicit Sub fill_parameters()
8
by: Blake Atlas | last post by:
The problem recieved from the debug log is the C2065 error regarding the 'm_pEffect' and 'm_pd3dDevice' being undeclared identifiers. D3DApplication::D3DApplication(){ m_pEffect = NULL; ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.