Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Repeat Code in next record shows a message and hault.

teefu ghulamFeb 27 2025

dear members,

CREATE TABLE ic_items
(code VARCHAR2(10),
item_desc VARCHAR2(100),
price NUMBER(14,4) DEFAULT 0
)
/

INSERT INTO ic_items
VALUES
('1','Chicken Thai Soup',1090)
/
INSERT INTO ic_items
VALUES
('2','Chicken Vegetable Soup',1050)
/
INSERT INTO ic_items
VALUES
('3','Egg Vegetable Soup',1050)
/
INSERT INTO ic_items
VALUES
('4','Hot & Sour Tomato Soup',1090)
/
INSERT INTO ic_items
VALUES
('5','Clear Chicken Tomato Soup',1050)
/
INSERT INTO ic_items
VALUES
('6','Clear Beef Tomato Soup',1050)
/
INSERT INTO ic_items
VALUES
('7','Sliced Chicken Chinese Pickle Soup',1050)
/
INSERT INTO ic_items
VALUES
('8','Chicken Corn Soup',1090)
/
INSERT INTO ic_items
VALUES
('9','Fried Wonton Noodle Soup',1150)
/
commit
/

My Query:
1. i don't want to use Lov in code field for selection of items on form
rather i want to write a code one by one, say four items by code
2. on the form when i write code its item_desc and price appears in respective fields
but when i write the same code again in next record,
it should give me the message that ' this code is already selected above'

on form, code field , when-validate-item trigger

begin

select item_desc , price
into v_item_desc, v_cost
from ic_items
WHERE code=:code;

:ic_lines.item_desc:=v_item_desc;
:ic_lines.RATE:=v_cost;

end;

Regards

Teefu

This post has been answered by Cookiemonster76 on Feb 28 2025
Jump to Answer
Comments
Post Details
Added on Feb 27 2025
2 comments
188 views