-5

I have a PL/SQL Sequence in oracle . I use oracle DB and php The code is as follows-

CREATE SEQUENCE SEQ_ID
START WITH 1
INCREMENT BY 1
MAXVALUE 99999999
MINVALUE 1
NOCYCLE;

insert values in column like this

UPDATE tableName SET columnName = seq_test_id.NEXTVAL

How can i implement it in php oci_parse

  • 4
    Your subject shouts "MySQL", yet you claim to be using Oracle. What exactly is it. (And sequences in Oracle have nothing to do with PL/SQL) –  Apr 16 '13 at 20:53
  • What the horse above me said, but also: if your question is "what is sequence in mysql", and also if i'm not mistaken: http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html – Nanne Apr 16 '13 at 20:55
  • @a_horse_with_no_name: sinc ehe mentioned `oci_parse` id assume its Oracle that actually applies... – prodigitalson Apr 16 '13 at 20:55
  • 2
    @prodigitalson: I assume this as well, but still maybe the OP means something completely different. –  Apr 16 '13 at 20:57
  • possible duplicate of [MySQL equivalent of Oracle's SEQUENCE.NEXVAL](http://stackoverflow.com/questions/9046971/mysql-equivalent-of-oracles-sequence-nexval) – Marc B Apr 16 '13 at 20:58
  • Actually i want to implement it in php using oracle DB. I need to update a column. What code should i need to write exactly? – Muntashir Are Rahi Apr 16 '13 at 21:00
  • So you are **not** using MySQL? –  Apr 16 '13 at 21:00
  • No man.I am using oracle database. – Muntashir Are Rahi Apr 16 '13 at 21:09

1 Answers1

0

Assuming you're going to Oracle, just set up the statement, parse, and execute. There's no need to do any binding because you have no bind variables. This is adapted from the PHP documentation of oci_parse:

$conn = oci_connect(your username, your password, your database);
$stid = oci_parse($conn, 'UPDATE tableName SET columnName = seq_test_id.NEXTVAL');
oci_execute($stid);
Ed Gibbs
  • 25,924
  • 4
  • 46
  • 69