{"record":{"id":"437c24df3facb9d9","repo":"pentaho/pentaho-kettle","slug":"dynamicsqlrow-exception-sqlfieldnameempty","errorCode":null,"errorMessage":"DynamicSQLRow.Exception.SQLFieldNameEmpty","messagePattern":"DynamicSQLRow\\.Exception\\.SQLFieldNameEmpty","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRow.java","lineNumber":218,"sourceCode":"      if ( data.db != null ) {\n        data.db.closeQuery( rs );\n      }\n    }\n\n  }\n\n  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {\n    meta = (DynamicSQLRowMeta) smi;\n    data = (DynamicSQLRowData) sdi;\n\n    Object[] r = getRow(); // Get row from input rowset & set row busy!\n    if ( r == null ) { // no more input to be expected...\n      setOutputDone();\n      return false;\n    }\n    if ( first ) {\n      if ( Utils.isEmpty( meta.getSQLFieldName() ) ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"DynamicSQLRow.Exception.SQLFieldNameEmpty\" ) );\n      }\n\n      if ( Utils.isEmpty( meta.getSql() ) ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"DynamicSQLRow.Exception.SQLEmpty\" ) );\n      }\n\n      // cache the position of the field\n      if ( data.indexOfSQLField < 0 ) {\n        data.indexOfSQLField = getInputRowMeta().indexOfValue( meta.getSQLFieldName() );\n        if ( data.indexOfSQLField < 0 ) {\n          // The field is unreachable !\n          throw new KettleException( BaseMessages.getString( PKG, \"DynamicSQLRow.Exception.FieldNotFound\", meta\n            .getSQLFieldName() ) );\n        }\n      }\n    }\n    try {\n      lookupValues( getInputRowMeta(), r );","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRow.java#L200-L236","documentation":"DynamicSQLRow.processRow, on the first processed row, checks that the step's 'SQL field name' setting is non-empty and throws this KettleException otherwise. The SQL field name identifies the input field whose value is used as the SQL statement, so the step cannot function without it.","triggerScenarios":"Executing a transformation whose Dynamic SQL Row step has an empty 'SQL field name' setting — typically after a partial configuration or a loadXML that lost the sql_fieldname tag.","commonSituations":"Newly added step not yet configured; step XML/repository record missing 'sql_fieldname'; copy-paste of step metadata that dropped the field setting.","solutions":["Open the Dynamic SQL Row step dialog and set the 'SQL fieldname' to the input field containing the SQL text","Ensure the upstream step actually produces that field","Re-save the transformation so the setting persists","Check the step's XML/repository record contains the sql_fieldname tag"],"exampleFix":"// before\n<sql_fieldname></sql_fieldname>\n// after\n<sql_fieldname>sql_statement</sql_fieldname>","handlingStrategy":"validation","validationCode":"// Before building/running the transformation:\nif (meta.getSQLFieldName() == null || meta.getSQLFieldName().trim().isEmpty()) {\n  throw new IllegalStateException(\"Dynamic SQL Row: SQL fieldname is not set\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  // processRow will throw on first row\n} catch (KettleException e) {\n  logError(\"Configure the SQL fieldname in the Dynamic SQL Row step\", e);\n  stopAll(); setErrors(1);\n  return false;\n}","preventionTips":["Always complete both SQL and SQL fieldname settings before saving","Verify the configured field exists in the input stream","Check the saved XML contains a non-empty <sql_fieldname>","Use transformation-level validation/preview before scheduling"],"tags":["kettle","configuration","validation"],"backgroundTag":"empty-required-field","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}