1
CREATE TABLE member 
(
    member_id member(10) 
        constraint member_member_id_pk PRIMARY KEY;
    last_name varchar2(25) 
        constraint member_last_name_nn NOT NULL;
    join_date DATE DEFAULT SYSDATE
        constraint member_join_date_nn NOT NULL;
) 

I am not sure what is wrong, I always get missing right parenthesis at line 3.

1
  • please change the title of the question. It should be a brief of your question Commented Jul 10, 2016 at 15:25

1 Answer 1

3

You must not use ; at the end of each line!! Use a , (comma) instead, except on the last line (before the )).

Also, for the NOT NULL, don't define an explicit constraint - on the other hand, for the default value for join_date, you should define an explicit constraint.

And the expression to use for that default constraint should be SYSDATETIME() for T-SQL - not SYSDATE() ....

create table member 
(
    member_id member(10) 
        constraint member_member_id_pk PRIMARY KEY,
    last_name varchar2(25) NOT NULL,
    join_date DATE NOT NULL
        constraint df_member_join_date DEFAULT (SYSDATETIME())
) 

And last but not least - this here is the official MSDN documentation for CREATE TABLE where you find all these details - and more - please consult it next time you need to know something like this!

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for prompt reply. Sure , i will consult the documentation first next time.
@LooChunMeng: if this answer helped you solve your problem, then please accept this answer. This will show your appreciation for the people who spent their own time to help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.