A database query by using a user-defined function (UDF) is provided. A computer-implemented method for performing the database query by using the UDF includes detecting whether a command for invoking the UDF to transmit a parameter value has been received. Based on detecting that the command for invoking the UDF to transmit the parameter value has been received: a first interface of the UDF is started; the parameter value is received through the first interface; and the received parameter value is transmitted to an external data source. The method further includes returning to detecting whether the command for invoking the UDF to transmit the parameter value has been received.