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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Sequence as column default

RE: Sequence as column default

From: DENNIS WILLIAMS <DWILLIAMS_at_LIFETOUCH.COM>
Date: Mon, 10 Mar 2003 14:40:09 -0800
Message-ID: <F001.0056568B.20030310144009@fatcity.com>


Thanks Alan. That sounds like good advice.

Dennis Williams
DBA, 40%OCP, 100% DBA
Lifetouch, Inc.
dwilliams_at_lifetouch.com

-----Original Message-----
Sent: Monday, March 10, 2003 4:00 PM
To: Multiple recipients of list ORACLE-L

Hi Dennis,

I'm afraid I can't help you with J2EE. I've only done a little experimenting with java code to produce simple command line programs.

However, since you are working with J2EE, you probably want to put as much code on the backend anyway. Much simpler to maintain that way.

-- 

Alan Davey
adavey_at_competitrack.com
718-482-4200 x106


On 3/10/2003 4:36 PM, DENNIS WILLIAMS <DWILLIAMS_at_LIFETOUCH.COM> wrote:

>Alan - You are correct. However, apparently that isn't easy to do
>with J2EE
>/ EJB, hense the trigger. Don't ask me why. When will they come out
>with a
>book titled:
> J2EE for the DBA
>
>Dennis Williams
>DBA, 40%OCP, 100% DBA
>Lifetouch, Inc.
>dwilliams_at_lifetouch.com
>
>-----Original Message-----
>Sent: Monday, March 10, 2003 3:16 PM
>To: Multiple recipients of list ORACLE-L
>
>
>You could also do it as part of your insert statement if you didn't
>want to
>use a trigger.
>
>INSERT INTO employees
> VALUES (employees_seq.nextval, 'John', 'Doe', 'jdoe',
> '555-1212', TO_DATE(SYSDATE), 'PU_CLERK', 2500, null, null,
> 30);
>
>Same thing goes with currval also.
>--
>
>Alan Davey
>adavey_at_competitrack.com
>718-482-4200 x106
>
>
>On 3/10/2003 3:49 PM, DENNIS WILLIAMS <DWILLIAMS_at_LIFETOUCH.COM> wrote:
>>Has anyone defined a sequence as the default value for a column?
>The
>>manual
>>is a little ambiguous (in my mind anyway):
>>
>>In the 8.1.7 manual:
>>Restriction: A DEFAULT expression cannot contain references to other
>>columns, the pseudocolumns CURRVAL, NEXTVAL, LEVEL, and ROWNUM,
>or
>>date
>>constants that are not fully specified.
>>
>>In 9i this was altered to read:
>>Restriction on Default Column Values
>>A DEFAULT expression cannot contain references to PL/SQL functions
>
>>or to
>>other columns, the pseudocolumns LEVEL, PRIOR, and ROWNUM, or date
>
>>constants
>>that are not fully specified.
>>
>>SQL> alter table test add
>> 2 (col3 number default addressID.NextVal);
>>(col3 number default addressID.NextVal)
>> *
>>ERROR at line 2:
>>ORA-00984: column not allowed here
>>
>>The alternative is to use an insert trigger, but it seems this would
>
>>be more
>>efficient. Since we are planning to use this a LOT, I thought I
>should
>>try
>>for a definate answer. Thanks for your patience.
>>
>>Dennis Williams
>>DBA, 40%OCP, 100% DBA
>>Lifetouch, Inc.
>>dwilliams_at_lifetouch.com
>>--
>>Please see the official ORACLE-L FAQ: http://www.orafaq.net
>>--
>>Author: DENNIS WILLIAMS
>> INET: DWILLIAMS_at_LIFETOUCH.COM
>>
>>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>>San Diego, California -- Mailing list and web hosting services
>>---------------------------------------------------------------------
>>To REMOVE yourself from this mailing list, send an E-Mail message
>>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and
>
>>in
>>the message BODY, include a line containing: UNSUB ORACLE-L
>>(or the name of mailing list you want to be removed from). You
>may
>>also send the HELP command for other information (like subscribing).
>>
>>
>>
>
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.net
>--
>Author: Alan Davey
> INET: adavey_at_competitrack.com
>
>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>San Diego, California -- Mailing list and web hosting services
>---------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and
>in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.net
>--
>Author: DENNIS WILLIAMS
> INET: DWILLIAMS_at_LIFETOUCH.COM
>
>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>San Diego, California -- Mailing list and web hosting services
>---------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and
>in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).
>
>
>
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Alan Davey INET: adavey_at_competitrack.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: DENNIS WILLIAMS INET: DWILLIAMS_at_LIFETOUCH.COM Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Received on Mon Mar 10 2003 - 16:40:09 CST

Original text of this message

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