시리얼을 생성해서 insert_into에 쓰는 예제좀 간단하게 하나만 알려주세요 T^T
머리가 안좋다보니.. 설명서에 있는 내용만으론 이해가 안되서......
알려주세요 T^T
DBMS마다 차이점이 있어서 혼선의 있으신것 같습니다.
홈페이지 입력마다 num컬럼 1부터 1씩 증가하는 예를 들겠습니다.
1. serial생성
CREATE SERIAL my_serial
START WITH 1
INCREMENT BY 1;
2. INSERT
INSERT INTO TEST_TBL(NUM,,,,,,,,,,,)
VALUES(my_serial.NEXT_VALUE,,,,,,,,,,,);
위와 같이 사용하시면 될것 같네요~
drop serial my_serial
insert into orders (order_no, product_name, quantity)
values (order_no_gen.next_value, \'computer\', 10);
select s.next_value from orders;
>시리얼을 생성해서 insert_into에 쓰는 예제좀 간단하게 하나만 알려주세요 T^T
>머리가 안좋다보니.. 설명서에 있는 내용만으론 이해가 안되서......
>
>알려주세요 T^T
//일단 시리얼은 다음과 같이 만들고
CREATE SERIAL test_table_seq START WITH 1;
//PHP로 간단한 예제를 드리면
$sql = \" insert into test_table (wr_id, wr_num, wr_reply, ....)
values (test_table_seq.next_value, $wr_num, \'$wr_reply\', ....)\";
$rst=cubrid_execute($cubrid_con, $sql);
//Mysql은 INSERT하면 auto increment값이 넘어와서 그값을 처리하면 되지만.
//큐브리드가 그 값을 알려면 다음과 같은 쿼리를 수행하시면 됩니다.
select test_table_seq.current_value FROM db_root;