Monday, July 26, 2010

Auto Incrementing primary key with Oracle




SQL> CREATE TABLE test
(id NUMBER PRIMARY KEY,
name VARCHAR2(30));

Table created.

SQL> CREATE SEQUENCE test_sequence
START WITH 1
INCREMENT BY 1;

Sequence created.

Now we can use that sequence in an BEFORE INSERT trigger on the table.

CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT
ON test
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT test_sequence.nextval INTO :NEW.ID FROM dual;
END;

Trigger created.

Share Article : Auto Incrementing primary key with Oracle
Share/Save/Bookmark

Wednesday, July 21, 2010

JSTL [S]crap


Iterating ArrayList of Arrays



<c:foreach items="${list}" var="innerList">
<c:foreach items="${innerList}" var="item">
<c:out value="${item}"></c:out>|

</c:foreach> <br>

</c:foreach>

Share Article : JSTL [S]crap
Share/Save/Bookmark