Skip to main content

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Inserting data records by using SQL

Suggest edit Updated on April 5, 2022

Use the ExecuteRDB SQL API to insert multiple records into your internal database in a batch through an activity. The ExecuteRDB SQL API directly inserts records in your database without requiring you to create a data object in Pega Platform.

Before you begin: Create an activity. For more information, see Creating an activity.

Note: Multiple inserts can only occur when the database does not contain a binary-large object (BLOB) column.
  1. In the header of Dev Studio, click CreateTechnicalActivity.

  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.

    For example:
    String sql = "insert into {class:" + <YourClassName>  + "} 
    values ('a','b')";
    ClipboardPage listPage = tools.getThread().createPage("Code-Pega-List", "MyPage");
    listPage.putString("pxObjClass", <YourClassName>);
    listPage.putString(".pyMaxRecords", String.valueOf(0));
    try{
    tools.getDatabase().executeRDB(sql, 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.

Did you find this content helpful? YesNo

Have a question? Get answers now.

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

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us