How run qostgresql query?

I need to run this query “SELECT COUNT(1) FROM litigation_file WHERE fileName = ?”
in UiPath. which activity should i use and what configuration should i make ?
can anybody help to achive this ?

Hi @Prabhakaran_Elango

  1. Use Execute Scalar activity (from Database activities).
  2. Configure the Database Connection:
  • Use Connect activity first to set up your DB connection (SQL Server, Oracle, MySQL, etc.).
  1. Properties for Execute Scalar:
  • ExistingDbConnection → Your DB connection variable
  • Sql → “SELECT COUNT(1) FROM litigation_file WHERE fileName = @fileName
  • Parameters → Add a parameter with:
    • Name: @fileName
    • Direction: Input
    • DbType: String
    • Value: your file name variable (e.g., fileNameVar)
  1. Output → Create a variable (e.g., countResult) of type Int32 to store the result.

This will give you the count of rows matching your fileName directly.

Hi @Prabhakaran_Elango

Use Execute Query activity with a DatabaseConnection. Set the SQL as “SELECT COUNT(1) FROM litigation_file WHERE fileName = @fileName” and add a parameter named fileName with its value. The result returns a DataTable from which you read the count.

For more:

If helpful, mark as solution. Happy automation with UiPath

@Prabhakaran_Elango

you need to use DB activities

you would get the connection strings required here - PostgreSQL connection strings - ConnectionStrings.com

cheers