# Serializing with Primitive Data Types

Serializing with primitive data types supports character strings, binary strings, and numeric data types. Below are a few (non-exhaustive) examples of serialization with primitive data types. See [the full list of supported primitive types](https://docs.deltastream.io/reference/sql-syntax/data-types#primitive-data-types).

### Character String

With the following DDL and query:

```sql
CREATE STREAM primitiveExample (
  "stringValue" VARCHAR
) WITH (
  'topic' = 'primitiveExample', 'value.format' = 'Primitive'
);
```

```sql
SELECT * FROM primitiveExample;
```

For the given input records:

```json
// input record bytes as String
abc

// output will read bytes as String
{ "stringValue": "abc" }
```

```json
// input record bytes as Integer
123

// output record will read bytes as String
{ "stringValue": "\u0000\u0000\u0000{" }
```

### Numeric

With the following DDL and query:

```sql
CREATE STREAM primitiveExample (
  "intValue" INTEGER
) WITH (
  'topic' = 'primitiveExample', 'value.format' = 'Primitive'
);
```

```sql
SELECT * FROM primitiveExample;
```

For the given input records:

```json
// input record bytes as Integer
123

// output will read bytes as Integer
{ "intValue": 123 }
```

```json
// input record bytes as String
abcd

// output will be read bytes as String
// It's also likely for other string bytes that there will be a 
// deserialization error while attempting to cast String to Integer
{ "intValue": 1633837924 }
```

### Binary String

With the following DDL and query:

```sql
CREATE STREAM primitiveExample (
  "bytesValue" VARBINARY
) WITH (
  'topic' = 'primitiveExample', 'value.format' = 'Primitive'
);
```

```sql
SELECT * FROM primitiveExample;
```

For the given input records:

```json
// input record bytes as Bytes
aG93ZHk=

// output will read bytes as Bytes
{ "bytesValue": "aG93ZHk=" }
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltastream.io/reference/sql-syntax/data-format-serialization/serde-with-primitive-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
