good point Jochem.  It was a new idea for me.

Chris, sorry.  It's O-racle.  I almost always state that, but I was more focused than I should've been on the particular code on the screen.  Blinking more probably would've helped.

OK, so just to be sure that I understand.  Here's a few tables below.  When I delete a poll, this'll delete the associated answeres automatically and because they're deleted, any results
associated with those answers will also automatically be deleted - just be deleting a particular poll, right?

Tables:

<!--- the poll info, yknow --->
create table fsnep_polls (
    p_id NUMBER Primary Key,
    p_date_added date,
    p_date_last_used date,
    p_question VARCHAR2(400),
    p_status NUMBER
)

<!--- all possible answers for any poll available --->
create table fsnep_pollAnswers (
    pA_id NUMBER Primary Key,
    pA_pollID NUMBER REFERENCES fsnep_polls(p_id) ON DELETE CASCADE,
    pA_answer VARCHAR2(400)
)

<!--- all votes with their poll and answer ID --->
create table fsnep_pollResults (
    pV_id NUMBER Primary Key,
    pV_date_added date,
    pV_poll_id NUMBER REFERENCES fsnep_polls(p_id),
    pV_poll_Answer NUMBER REFERENCES fsnep_pollAnswers(pA_id) ON DELETE CASCADE,
    pV_ip VARCHAR2(20)
)

I appreciate the answers and the help.

>daniel kessler wrote:
>> The create table works until I add the ON CASCADING DELETE.
>
>
>ON DELETE CASCADE should be specified on the same line as the
>constraint it applies to. (How else could you have one FK with
>CASCADE and another one with NO ACTION?)
>
>Jochem
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to