I want do auto generate bill no in this format (INV1/23) without using sequence in oracle apex. Kindly write query in plsql.
I used sequence for this process, but it is not working for this. and it have to show on interactive report with form. Like when i enter data about bill like order no, order date, credit terms, credit days and remarks so it should be generated by itself in my given format.
Just the code to generate that invoice number is not the solution. You will run into issues very soon.
One problem with generating an invoice number on the fly by looking at the last invoice number (instead of a sequence) is conflicts. User 1 opens the form, the code checks the last invoice number (INV1/23) and generates a new one - lets say INV2/23. Now user 2 opens the form in another session. The code will generate the same INV2/23 because the last saved value is INV1/23 and then when the 2nd use saves... there will be a unique constraint violation. My advice would be to create a table with generated invoice numbers of the format you want (your requirement is too vague to give you code) and have some code that decides which number is the next to pick up, so each value is only used once. This would also allow you to re-use orphan values (eg when an invoice number is used but then transaction is cancelled). I suggest watching this video from Connor that explains the solution I just described. It is for a sequence but you could use the same logic for an invoice number.
Here is the code.
Then in your apex form, create a before submit computation on the invoice number with source (pl/sql expression)
Note that you should only compute the invoice number before submit - if it is done on the form then the invoice number is marked as 'used'. So if the user then closes his screen without saving the invoice you'll lose that number.
Note that you'll need some code to populate the invoice_numbers table every year and some code to check you're not running out of numbers.