# Getting SequenceFeature to work with Oracle

**URL:** <https://discourse.laminas.dev/t/getting-sequencefeature-to-work-with-oracle/1362>\
**Category:** Components & MVC\
**Tags:** laminas-db\
**Created:** [February 7, 2020, 4:44pm UTC](https://discourse.laminas.dev/t/getting-sequencefeature-to-work-with-oracle/1362 "2020-02-07T16:44:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![swordfish](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@swordfish](https://discourse.laminas.dev/u/swordfish)\
**Post date:** [February 7, 2020, 4:44pm UTC](https://discourse.laminas.dev/t/getting-sequencefeature-to-work-with-oracle/1362/1 "2020-02-07T16:44:51Z")

</div>

I’m trying to work with an Oracle table whose id should be generated by an Oracle sequence. This seems to be what SequenceFeature should do for me.

I create the TableGateway with

```
$features = new \Zend\Db\TableGateway\Feature\SequenceFeature('PV_ID', 'PV_ID_SEQ');
        $tableGateway = new TableGateway('PREVIEW', $dbAdapter, $features, $resultSetPrototype);
```

and I get back _ORA-08002: sequence PV\_ID\_SEQ.CURRVAL is not yet defined in this session_

am I doing something wrong or does SequenceFeature not work with Oracle?

Could [https://github.com/zendframework/zend-db/pull/146](https://github.com/zendframework/zend-db/pull/146) be the fix for this?

---

<div class="post-metadata">

**Author:** ![swordfish](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@swordfish](https://discourse.laminas.dev/u/swordfish)\
**Post date:** [March 13, 2020, 11:39am UTC](https://discourse.laminas.dev/t/getting-sequencefeature-to-work-with-oracle/1362/2 "2020-03-13T11:39:42Z")

</div>

Absent any further information on getting SequenceFeature to work with Oracle, my workaround is simply to use

‘EX\_ID’ =\> new Zend\Db\Sql\Expression(‘example\_seq.NEXTVAL’)

in the hydrator
