I want to show message using dynamic action say this data already exist after check the database i tried to do that using excute server side code then alert i tried to use trigger and automation
You didn't describe what you're doing so I'm assuming this is a form region and you want the message to appear on change of the page item. Here is an example with a form on the EMP/DEPT sample data. Functionality is that on change of the item P59_ENAME, a dynamic action fires and shows a javascript alert if the ename already exists. In my case this is page 59. I tested this on apex 21.2
EMPRun the form, change the ENAME to an existing value and click in another field on the page. You'll get the popup.
Triggers or Automations cannot be used to achieve this functionality.