Hi,
I am trying to use a form with a Button to make a new record, this sets the prodid feild to max(prodid) + 1 from the products table in the database. It then sets everything to blank.
This works fine, but, when i try to save (another button) the record, which has:
Code:insert into product
values (:PRODUCT.PRODID, :PRODUCT.SUPPLIERID, :PRODUCT.DESCRIPTION, :PRODUCT.PRICE);
COMMIT;
As the PL/SQL For the WHEN-BUTTON-PRESSE trigger.
When this button is pressed, the Runtime window says at the bottom:
"FRM-40735: WHEN-BUTTON-PRESSED trigger raised unhandled exception ORA-00001"
If i take Database Error from the menu, it displays:
Code:UPDATE PRODUCT SET PRODID=:1,SUPPLIERID=:2,DESCRIPTION=:3,PRICE=:4 WHERE ROWID=:5
As being the SQL statement in error.
This is (obviously) not right, since on the form Prodid is 3009, supplierid is 1005 etc.
In SQL *Plus, if i select * from product where prodid = 1005, 3009, :1 I get various errrors (no rows selected for the first two and Bind variable "1" not declared for the last.
Similarily, if i use the Update button, which has WHEN-BUTTON-PRESSED code of:
Code:UPDATE product
SET supplierid = :PRODUCT.SUPPLIERID,
description = :PRODUCT.DESCRIPTION,
price = :PRODUCT.PRICE
WHERE
prodid = :PRODUCT.PRODID;
COMMIT;
It gives an error (which i would expect since it doesnt exist yet).
Specifically: FRM-40509: ORACLE error: unable to UPDATE record.
The SQL statement in error is the same as previously mentioned in this.
If i use Forms Runtime's own Add Item Button, along with my Update button this inserts without a problem, and, as expected the row appreas in SQL *Plus.
I appologize if i have done something stupidly obvious but i am new to Oracle and would appreciate any help as to why i cant use my own Button and Save for the insersion of new data.
Thank you.
Enter your message below
Sign in or Join us (it's free).