Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Auto incrementing key

Re: Auto incrementing key

From: EdStevens <quetico_man_at_yahoo.com>
Date: 10 Apr 2006 07:27:24 -0700
Message-ID: <1144679244.846474.317640@i39g2000cwa.googlegroups.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US