Home » SQL & PL/SQL » SQL & PL/SQL » Trying to use NextVALUE to establish the next sequential up number to go into a mandatory column en
Trying to use NextVALUE to establish the next sequential up number to go into a mandatory column en [message #6958] Tue, 13 May 2003 12:53 Go to next message
Andy Grace
Messages: 9
Registered: May 2003
Junior Member
So I created a procedure within a program unit from a form)

PROCEDURE new_ID IS
V_count NUMBER;

BEGIN
select count(*)
into V_count
from num_ref
where ref_type = 1
and ext_ref = 2
and REF_ID = :block2.REF_ID;

if V_count = 0 then
select num_Ref_SEQ.nextval
into :block2.Ref_ID
from dual;
end if;
END;

I figure this should work but it's not....any ideas?
Re: Trying to use NextVALUE to establish the next sequential up number to go into a mandatory colum [message #6964 is a reply to message #6958] Wed, 14 May 2003 00:16 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
It should work but it's not? Does that mean you get a compilation error, or does it mean that the output is not what you expected it to be? Or is the form not using the program unit as you expected? In what trigger have you put it?

The column ref_id of your num_ref table, is it a unique key? If duplicates are possible, perhaps that's the problem. Have you tested the program unit itself?

Without more details, it is difficult to guess what's wrong here.

MHE
Previous Topic: how to delete duplicate rows..
Next Topic: Oracle 9i Guidance
Goto Forum:
  


Current Time: Tue Apr 23 16:43:40 CDT 2024