Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> creating numbers from null values withing a set range already being used

creating numbers from null values withing a set range already being used

From: Patrick Parker <PParker_at_ins.gte.com>
Date: 12 Dec 2001 14:11:22 -0800
Message-ID: <e6e8dd72.0112121411.7b80d092@posting.google.com>

I am sure this has an easy solution but, Being a bonehead I am having difficulty with this. I work with a billing system that has a primary key that ranges between 32,000 thru -32,000 roughly, The contractors in their infinite wisdom decided to pick numbers randomly from this range to use the primary key for the initial Description table and foreign key for a number of other tables. I have been trying to write a stored procedure to find the null values and then give it the sequential number in the series of numbers and return the new set of numbers so that they can be used when new products are added to the database.

I have been working on a stored procedure which uses a couple of variables set as v_max_value :=32,000, v_min_value, v_count, v_new_value

the cursor I am using is select Desc_no /*the Primary key*/ from the table

the procedure starts at the v_max_value and a checks if the value is not Null
then v_count = desc_code
If the value is null and count greater than 0 then v_new_value = v_count - 1,

My question is has anyone else had this type of problem? and do you have an answer,logic, or stored procedure that you could share with me? Received on Wed Dec 12 2001 - 16:11:22 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US