OPEN

|                OPEN                |                            |                            |                  |                              |
|:----------------------------------:|----------------------------|----------------------------|------------------|------------------------------|
|[Prev](ecpg-sql-get-descriptor.html)|[Up](ecpg-sql-commands.html)|36.14. Embedded SQL Commands|[Home](index.html)| [Next](ecpg-sql-prepare.html)|

---

## OPEN

OPEN — open a dynamic cursor

## Synopsis

```
OPEN cursor_name
OPEN cursor_name USING value [, ... ]
OPEN cursor_name USING SQL DESCRIPTOR descriptor_name

```

## Description

`OPEN` opens a cursor and optionally binds actual values to the placeholders in the cursor's declaration. The cursor must previously have been declared with the `DECLARE` command. The execution of `OPEN` causes the query to start executing on the server.

## Parameters

*`cursor_name`*

 The name of the cursor to be opened. This can be an SQL identifier or a host variable.

*`value`*

 A value to be bound to a placeholder in the cursor. This can be an SQL constant, a host variable, or a host variable with indicator.

*`descriptor_name`*

 The name of a descriptor containing values to be bound to the placeholders in the cursor. This can be an SQL identifier or a host variable.

## Examples

```
EXEC SQL OPEN a;
EXEC SQL OPEN d USING 1, 'test';
EXEC SQL OPEN c1 USING SQL DESCRIPTOR mydesc;
EXEC SQL OPEN :curname1;

```

## Compatibility

`OPEN` is specified in the SQL standard.

## See Also

[DECLARE](ecpg-sql-declare.html), [CLOSE](sql-close.html)

---

|[Prev](ecpg-sql-get-descriptor.html)|[Up](ecpg-sql-commands.html)| [Next](ecpg-sql-prepare.html)|
|:-----------------------------------|:--------------------------:|-----------------------------:|
|           GET DESCRIPTOR           |     [Home](index.html)     |            PREPARE           |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>