views:

71

answers:

2

I have created sequence in database like,

CREATE SEQUENCE seq INCREMENT BY 1;

How can i assign the current value of seq in $t;

<?php

$t=?;

?>
+1  A: 

Run this query and fetch the result of it:

SELECT seq.CURRVAL FROM dual
Bill Karwin
Won't work unless the session has previously called seq.NEXTVAL.
Jeffrey Kemp
@Jeffrey: Yes, good point.
Bill Karwin
+1  A: 

If you want the next value from the sequence you would run the sql statement below and fetch back the results of the myseq column.

select seq.nextval myseq
  from dual;
Dougman