## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> CSVENCODE[CSVENCODE]:::quoted
CSVENCODE --> End((END))
```
## Purpose
The `CSVENCODE` SQL function returns the input text encoded as CSV adhering to RFC 4180:
- field separator `,`
- record separator CR, LF and CR/LF
- quoting character `"`
- escaped quoting character `\"`
- no headers
See also [[CSVDECODE]].
Parameters:
- Input (`varchar2`): the input which will be encoded to CSV from text.
Returns: A text which is the input encoded as CSV as `varchar2`.
## Examples
The following example retrieves the CSV representation of the value `a,b,c,d`:
```sql
select csvencode('a,b,c,d')
----------------
"a,b,c,d"
```
The following example retrieves the CSV representation of the value `text`:
```sql
select csvencode('text')
----------------
text
```