Search code examples
sqloracleoracle-apex-5

How do you delete rows specified from an object in oracle?


I have a drop down box on a page in my oracle apex application, I'd like to use the drop down box which displays a company's data(company name) within the company table (which I have achieved); which the user can use to identify specifically what company they'd like to delete. I'd then like to use a button to delete the selected company, and that's what I cannot figure out.

So far I have got as far as using dynamic actions to delete every entry in the table.

Pseudo code for what I am trying to achieve:

SELECT COMPANY_ID FROM COMPANYLIST,
DELETE SELECTED;

Company list being the drop-down box name.

Description of the button and the action

enter image description here


Solution

  • It sounds like you are just struggling with the delete statement?

    It should be something like this.

    DELETE FROM company
    WHERE company_id = (SELECT company_id 
                        FROM companylist
                        WHERE upper(company_name) = upper(:P1_COMPANY_NAME) ); 
    

    Replacing company with whatever your company table is called, and :P1_COMPANY_NAME with whatever your select list item is.