I am struggling to split dollar amount equally in 4 parts and inserting the rows in the table.
This is what I want . Suppose I have $88.13 ( which is 88 dollars and 13 cents) I need to have sql script which split it equally and if there is any remaining penny balance it should go to the maximum sequence while inserting to the table.
For Eg:
create table split_dollar(seq number, amount number(12,2));
insert into split_dollar (seq,amount) VALUES (1,22.03);
insert into split_dollar (seq,amount) VALUES (2,22.03);
insert into split_dollar (seq,amount) VALUES (3,22.03);
insert into split_dollar (seq,amount) VALUES (4,22.04);
SQL> select * from split_dollar;
SEQ AMOUNT
---------- ----------
1 22.03
2 22.03
3 22.03
4 22.04
Please let me know how I can achieve this.
Thanks,
Ann