Re: [CDBI] Sequences in Class::DBI?

"Rod McChesney" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
> __PACKAGE__->set_sql('Nextval', <<NEXTVAL);
> SELECT ORDER_SEQ.NEXTVAL from DUAL
> NEXTVAL

Note that you can also do this generically for Oracle in a your CDBI base class:

__PACKAGE__->set_sql(Nextval => 'SELECT %s.NEXTVAL from DUAL');

I got that from the Oracle sequence plugin.

Rod

On 4/26/06, [email protected] <[email protected]> wrote:
> Here's a snippet of how we do it for our Oracle system
>
> package Orders;
>
> use base qw(OurSystem::DBI);
> ...
> __PACKAGE__->sequence(qw(ORDER_SEQ));
>
> __PACKAGE__->set_sql('Nextval', <<NEXTVAL);
> SELECT ORDER_SEQ.NEXTVAL from DUAL
> NEXTVAL
>
>
> Obviously the postscript way of selecting the next value from a sequence
> will vary, bit you just need to stick that in the set_sql for 'NextVal'
>
> Leif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.