LinkedIn
Copied!

Table of Contents

Deleting data records by using SQL

Version:

Only available versions of this content are shown in the dropdown

Use the ExecuteRDB SQL API to delete records in your database through an activity, without requiring you to delete a data object in Pega Platform.

Create an activity. For more information, see Creating an activity.
  1. In the header of Dev Studio, click Create Technical Activity .

  2. In the activity rule form, enter a label, select an application and the associated ruleset, and then click Create and open.

  3. On the Steps tab, in the Label field, enter a unique identifier for the step.

  4. In the Method list, select Java.

  5. To the left of the Method list, click the Expand icon.

  6. In the Method Parameters section, in the Java Source field, enter an ExecuteRDB method.

    String delete = "delete from {class:" + <YourClassName> + "} where id = \\{fn concat('a', 'bc')\\}"; ClipboardPage listPage = tools.getThread().createPage("Code-Pega-List", "MyPage"); listPage.putString(".pxObjClass", <YourClassName>); listPage.putString(".pyMaxRecords", String.valueOf(0)); try{tools.getDatabase().executeRDB(delete , listPage)); } catch(Exception err) {oLog.infoForced("Exception occurred"); }<YourClassName> is the name of the class into which you want to insert records.
  7. Click Save.

  8. Start the insert of records into your internal database by running the activity.

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.