SetParametersForExecuteStatements

This method binds a JSON stream of parameters for SQL script execution.

Declaration

// C#
public static void SetParametersForExecuteStatements(this OracleCommand cmd, StreamReader jsonParameters);

Parameters

The OracleCommand instance

The parameter information to bind to the script’s SQL and PL/SQL statements.

Remarks

Parameters can only be bound by name using this method.

Bind Parameter Format

SQL script execution parameters are bound using the following JSON schema format:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:oracle:manageddataaccess:sqlscriptexecution:schemas:bind-parameters:1.0",
  "title": "BindParameters",
  "type": "array",
  "items": {
    "type": "object",
    "required": [
      "name",
      "type",
      "direction"
    ],
    "properties": {
      "name": {
        "type": "string"
      },
      "type": {
        "$ref": "#/$defs/oracleNativeType"
      },
      "direction": {
        "type": "string",
        "enum": [
          "Input",
          "Output",
          "InputOutput",
          "ReturnValue"
        ]
      },
      "value": {
        "description": "Value for the bind parameter."
      },
      "size": {
        "type": "integer",
        "minimum": 1
      },
      "precision": {
        "type": "integer",
        "minimum": 0
      },
      "scale": {
        "type": "integer",
        "minimum": -127
      }
    },
    "allOf": [
      {
        "if": {
          "properties": {
            "direction": {
              "enum": [
                "Output",
                "InputOutput",
                "ReturnValue"
              ]
            },
            "type": {
              "enum": [
                "VARCHAR2",
                "NVARCHAR2",
                "CHAR",
                "NCHAR",
                "RAW",
                "LONG RAW"
              ]
            }
          },
          "required": [
            "direction",
            "type"
          ]
        },
        "then": {
          "required": [
            "size"
          ]
        }
      },
      {
        "if": {
          "properties": {
            "direction": {
              "enum": [
                "Input",
                "InputOutput"
              ]
            }
          },
          "required": [
            "direction"
          ]
        },
        "then": {
          "required": [
            "value"
          ]
        }
      }
    ],
    "additionalProperties": false
  },
  "$defs": {
    "oracleNativeType": {
      "type": "string",
      "description": "Oracle native data type or PL/SQL data type.",
      "enum": [
        "NUMBER",
        "INT",
        "INTEGER",
        "LONG",
        "BINARY_FLOAT",
        "BINARY_DOUBLE",
        "VARCHAR2",
        "NVARCHAR2",
        "CHAR",
        "NCHAR",
        "CLOB",
        "NCLOB",
        "BLOB",
        "BFILE",
        "DATE",
        "TIMESTAMP",
        "TIMESTAMP WITH TIME ZONE",
        "TIMESTAMP WITH LOCAL TIME ZONE",
        "INTERVAL DAY TO SECOND",
        "INTERVAL YEAR TO MONTH",
        "RAW",
        "LONG RAW",
        "BOOLEAN",
        "JSON",
        "VECTOR",
        "REFCURSOR",
        "SYS_REFCURSOR",
        "XMLTYPE"
      ]
    }
  }
}

See Also: