Skip to Main Content

Oracle Forms

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!

How to call sequence in Oracle Forms

643155Jan 19 2009 — edited Jan 19 2009
Hi,

I am using Oracle Developer Suite 10g. I want to call a sequence that I have created in SQL Plus. When I try to call the sequence in a trigger for a command button (WHEN-BUTTON-PRESSED) the compiler tells me that the sequence cannot be used in this context. I am passing the sequence to a procedure as a parameter. Let me show you some code:

My table is:

Location(loc_id, loc_name);
primary key is loc_id

My sequence is:

CREATE SEQUENCE loc_seq
MINVALUE 1
MAXVALUE 999999
START WITH 1
INCREMENT BY 1
CACHE 20;

My procedure is:

CREATE OR REPLACE PROCEDURE loc_change (v_loc_id IN Location.loc_id%TYPE, v_loc_name IN Location.loc_name%TYPE) AS
BEGIN
INSERT INTO Location(Location.loc_id, Location.loc_name)
VALUES (v_loc_id, v_loc_name);
COMMIT;
END loc_change;

My WHEN-BUTTON-PRESSED trigger is

BEGIN
loc_change(loc_seq.nextval, :DATA_BLOCK.VARIABLE);
END;

All that I need to do is generate a random number for the parameter passed that is the primary key for Location, from within my trigger. Any thoughts?
This post has been answered by 548625 on Jan 19 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2009
Added on Jan 19 2009
4 comments
17,593 views