I need obtain the value from a sequence in Oracle8i

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
skull cowboy
Forum Newbie
Posts: 14
Joined: Tue Jan 21, 2003 3:04 am

I need obtain the value from a sequence in Oracle8i

Post by skull cowboy »

Hi all,

I need obtain a value from a sequence in Oracle 8i, Could someone show me a source code in PHP for that?

I try to do that with the next source code, but it's not run corretly:

$c1=ocilogon("username","password","sid");
$sql="select name.NEXTVAL FROM table";
$stmt=ociparse($c1,$sql);
ociexecute($stmt,OCI_DEFAULT);
print OCIResult($stmt,"name");

If someone cam help me, please send me a e-mail with the solution to
tiridium@hotmail.com because i only can consult this e-mail address.

Thanks in advance.

Bye.
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

You just need to give it an alias

ie select seqname.nextval newseq from dual;

then get the column named newseq.
Post Reply