How to INSERT Array of Values into DB2 Table

Here is an SQL query that to INSERT array of values into a DB2 table.

In DB2 or any RDBMS, there are a variety of rules you need to follow before inserts a row into a Table. In my previous post DB2: 4 TOP QUESTIONS ON SQL INSERT VALUES, I have explained these.

Here is Apache Spark3 With Scala Hands-on

SQL Query to Insert Array of Values into DB2 Table

Below is INSERT SQL. Here you need to supply Array of VALUES.

  INSERT INTO srinmf_test 
    VALUES (:HV1, :HV2, :HV3)


  • In the above query, the table name is srinimf_test.
  • The ACT_NO, ACT_KWD, ACT_DESC are the column names in that table.
:HV1, :HV2 and :HV3 are host variables.
  • The num_rows in For clause says, the number of rows to insert.
  • This way of writing SQL Query is called array inserting in DB2.

Related Posts

Get new content delivered directly to your inbox.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.