Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Auto incrementing key
chani wrote:
> Thank you Very much everyone who helpled me.
>
> I could do my requirement with following trigger
>
> CREATE OR REPLACE TRIGGER STUDENTID_T
> BEFORE INSERT
> ON student
> FOR EACH ROW
> BEGIN
> IF (:NEW.student_id IS NULL) THEN
> SELECT CONCAT('s-',LPAD(CAST(id.NEXTVAL as char),8,'0')) INTO
> :NEW.student_Id FROM DUAL;
> END IF;
> END
>
>
> But one more silly question. Can anyone tell me what is the meaning of
> 'from DUAL'
> I used it without knowing. But like to know the meaning of it.
>
> Thank you
DUAL is a dummy table defined as one row/one column. The syntax of SELECT requires a FROM reference, even if none of what is selected actually comes from a table.
tahiti.com is your friend. Received on Mon Apr 10 2006 - 09:27:24 CDT