RowID , RowNum and Number Key???
Dear Gurus
I have a Little problem which I want to know for my personal knowledge and share with forum.
I have recently developed small scale Inventory Management System using Form6i and Database 9.2. I have created three tables for cash sale e.g. CashMaster, Cashdetail and Cashdetdetail. Also for credit sale, three table
CreditMaster, CreditDetail and Creditdetdetail and so on (lots of other tables, just for this problem I am considering two types of tables Cash and Credit).
As the name suggested CashMaster is Master table, CashDetail is Detail table of CashMaster and CashDetDetail is again Detail table of CashMaster (One Master 2 Details Logic).
I have used trigger at CashMaster block level to calculate and populate the Cash Bill No to three tables as follow
(I didnot used sequence to generate CashBillNo as controling it a bit dificult and then you hae to put further check on Form success & saving it .... )
Trigger Name:When New Block Instance
Level: Block Level
Item: CSBILLNO (CashMaster Bill No)
select (nvl(max(csbillno), 0) + 1) into :cashmaster.csbillno from cashmaster;
select (nvl(max(csbillno), 0) + 1) into :cashdetail.csbillno from cashmaster;
select (nvl(max(csbillno), 0) + 1) into :cashdetdetail.csbillno from cashmaster;
Compile and save it and there are no issues. Even while executing the form there is NO ISSUE (All Master Detail & Detail are taking input and saving it).
But when I look into these tables in database using the cammand
SQL> select rowid, rownum, csbillno from cashmaster;
It generates following output
ROWID ROWNUM CSBILLNO
AAAHbhAABAAAMZCAAA 1 3
AAAHbhAABAAAMZCAAB 2 1
AAAHbhAABAAAMZCAAC 3 2
AAAHbhAABAAAMZCAAD 4 4
Similarly it is doing with CreditMaster. After 4 or 5 records it starts Aappending the records rightly at right place as shown above in record 4 (Rowid, RowNum and Record no should be equal or Something else ).
I want to know why it is happening and what is the solution.
Thanks in advance!!!
Best Regards
Thunder