Search code examples
oracleplsqloracle-apexoracle-apex-5.1

Adding Buttons referenced to a database table column in oracle apex


I am building a Application for a Resturent using Oracle APEX. I need to build a Interface like the image shown below the interface is something like this I need to link those buttons to the items table in my database, when user click on the button the item should go to the bill preview table with the price so it can be printed.

Is this possible to do? If so how?


Solution

    • create a button (for example, P1_BTN_SPRITE) which submits page when pressed

    • create process that fires when P1_BTN_SPRITE button is pressed

    • process would then

      insert into bill (bill_id, item_id, price)
      select :P1_BILL_ID,
        i.item_id,
        i.price
      from items i
      where i.item_id = 1234;   --> presuming that 1234 is ID that means "Sprite"
      
      • where does P1_BILL_ID value come from? That's what you probably know; might be a sequence-generated value upon page load (when bill is created)
    • because of submit, page would refresh and "Bill preview" regions should also refresh and show new bill contents