> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/15/client-interfaces/ecpg-embedded-sql-in-c/35.14.-embedded-sql-commands/ecpg-sql-set-descriptor.md).

# SET DESCRIPTOR

## SET DESCRIPTOR

SET DESCRIPTOR — set information in an SQL descriptor area

### Synopsis

```

SET DESCRIPTOR descriptor_name descriptor_header_item = value
SET DESCRIPTOR descriptor_name VALUE number descriptor_item = value [, ...]
```

### Description

`SET DESCRIPTOR` populates an SQL descriptor area with values. The descriptor area is then typically used to bind parameters in a prepared query execution.

This command has two forms: The first form applies to the descriptor “header”, which is independent of a particular datum. The second form assigns values to particular datums, identified by number.

### Parameters

*`descriptor_name`*

A descriptor name.

*`descriptor_header_item`*

A token identifying which header information item to set. Only `COUNT`, to set the number of descriptor items, is currently supported.

*`number`*

The number of the descriptor item to set. The count starts at 1.

*`descriptor_item`*

A token identifying which item of information to set in the descriptor. See [Section 36.7.1](/15/client-interfaces/ecpg-embedded-sql-in-c/35.7.-using-descriptor-areas.md#ECPG-NAMED-DESCRIPTORS) for a list of supported items.

*`value`*

A value to store into the descriptor item. This can be an SQL constant or a host variable.

### Examples

```

EXEC SQL SET DESCRIPTOR indesc COUNT = 1;
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1;
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val1, DATA = 'some string';
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2null, DATA = :val2;
```

### Compatibility

`SET DESCRIPTOR` is specified in the SQL standard.

### See Also

[ALLOCATE DESCRIPTOR](/15/client-interfaces/ecpg-embedded-sql-in-c/35.14.-embedded-sql-commands/ecpg-sql-allocate-descriptor.md), [GET DESCRIPTOR](/15/client-interfaces/ecpg-embedded-sql-in-c/35.14.-embedded-sql-commands/ecpg-sql-get-descriptor.md)

***

原文：[PostgreSQL 15.19 Documentation](/15/client-interfaces/ecpg-embedded-sql-in-c/35.14.-embedded-sql-commands/ecpg-sql-set-descriptor.md)（英文原文，待翻譯）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/15/client-interfaces/ecpg-embedded-sql-in-c/35.14.-embedded-sql-commands/ecpg-sql-set-descriptor.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
