dbTalk Databases Forums  

Missing right parenthesis

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Missing right parenthesis in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jon
 
Posts: n/a

Default Missing right parenthesis - 07-10-2003 , 01:36 PM






Hi,

I have a SQL script which contain SQL statements very similar to the
example below that create and modify a number of tables. The SQL
statement below is giving me a problem.

CREATE TABLE meta_packet
(
id NUMBER,
s9_pkt_id NUMBER(20),
ts TIMESTAMP(9),
inbound NUMBER(1),
ether_type NUMBER(5),
ip_proto NUMBER(3),
accept NUMBER(3),
mac_pair_id NUMBER,
ether_body_id NUMBER,
ip_body_id NUMBER,
conv_pair_id NUMBER,
payload_id NUMBER
);
ALTER TABLE meta_packet ADD
(
CONSTRAINT meta_packet_pk PRIMARY KEY (id),
CONSTRAINT mac_pair_fk FOREIGN KEY (mac_pair_id)
REFERENCES mac_addr_pair (id),
CONSTRAINT payload_fk FOREIGN KEY (payload_id)
REFERENCES payload (id)
USING INDEX TABLESPACE indx);

Specifically, the problem is in the "ALTER TABLE meta_packet ADD"
portion of this statement. When I execute the ALTER TABLE portion of
the above statement from the SQL> prompt as follows, I am getting this
error:

SQL> ALTER TABLE meta_packet ADD
2 (
3 CONSTRAINT meta_packet_pk PRIMARY KEY (id),
4 CONSTRAINT mac_pair_fk FOREIGN KEY (mac_pair_id)
5 REFERENCES mac_addr_pair (id),
6 CONSTRAINT payload_fk FOREIGN KEY (payload_id)
7 REFERENCES payload (id)
8 USING INDEX TABLESPACE indx);
USING INDEX TABLESPACE indx)
*
ERROR at line 8:
ORA-00907: missing right parenthesis

Is there a syntax problem, are there too many CONSTRAINT/REFERENCES
statements or are the CONSTRAINT/REFERENCES statements in the wrong
order? I am at a loss to understand the problem. Any ideas?

Thanks,

Reply With Quote
  #2  
Old   
Daniel Morgan
 
Posts: n/a

Default Re: Missing right parenthesis - 07-10-2003 , 03:04 PM






Jon wrote:

Quote:
Hi,

I have a SQL script which contain SQL statements very similar to the
example below that create and modify a number of tables. The SQL
statement below is giving me a problem.

CREATE TABLE meta_packet
(
id NUMBER,
s9_pkt_id NUMBER(20),
ts TIMESTAMP(9),
inbound NUMBER(1),
ether_type NUMBER(5),
ip_proto NUMBER(3),
accept NUMBER(3),
mac_pair_id NUMBER,
ether_body_id NUMBER,
ip_body_id NUMBER,
conv_pair_id NUMBER,
payload_id NUMBER
);
ALTER TABLE meta_packet ADD
(
CONSTRAINT meta_packet_pk PRIMARY KEY (id),
CONSTRAINT mac_pair_fk FOREIGN KEY (mac_pair_id)
REFERENCES mac_addr_pair (id),
CONSTRAINT payload_fk FOREIGN KEY (payload_id)
REFERENCES payload (id)
USING INDEX TABLESPACE indx);

Specifically, the problem is in the "ALTER TABLE meta_packet ADD"
portion of this statement. When I execute the ALTER TABLE portion of
the above statement from the SQL> prompt as follows, I am getting this
error:

SQL> ALTER TABLE meta_packet ADD
2 (
3 CONSTRAINT meta_packet_pk PRIMARY KEY (id),
4 CONSTRAINT mac_pair_fk FOREIGN KEY (mac_pair_id)
5 REFERENCES mac_addr_pair (id),
6 CONSTRAINT payload_fk FOREIGN KEY (payload_id)
7 REFERENCES payload (id)
8 USING INDEX TABLESPACE indx);
USING INDEX TABLESPACE indx)
*
ERROR at line 8:
ORA-00907: missing right parenthesis

Is there a syntax problem, are there too many CONSTRAINT/REFERENCES
statements or are the CONSTRAINT/REFERENCES statements in the wrong
order? I am at a loss to understand the problem. Any ideas?

Thanks,
Put each ALTER TABLE into a separate statement. It improves
maintainability as well as giving you
valid syntax.

--
Daniel Morgan
http://www.outreach.washington.edu/e...ad/oad_crs.asp
damorgan@x.washington.edu
(replace 'x' with a 'u' to reply)




Reply With Quote
  #3  
Old   
Tim X
 
Posts: n/a

Default Re: Missing right parenthesis - 07-12-2003 , 12:15 AM



Quote:
"Jon" == Jon <jhoug2 (AT) hotmail (DOT) com> writes:
Jon> Hi, I have a SQL script which contain SQL statements very
Jon> similar to the example below that create and modify a number of
Jon> tables. The SQL statement below is giving me a problem.

Jon> CREATE TABLE meta_packet ( id NUMBER, s9_pkt_id NUMBER(20), ts
Jon> TIMESTAMP(9), inbound NUMBER(1), ether_type NUMBER(5), ip_proto
Jon> NUMBER(3), accept NUMBER(3), mac_pair_id NUMBER, ether_body_id
Jon> NUMBER, ip_body_id NUMBER, conv_pair_id NUMBER, payload_id
Jon> NUMBER ); ALTER TABLE meta_packet ADD ( CONSTRAINT
Jon> meta_packet_pk PRIMARY KEY (id), CONSTRAINT mac_pair_fk FOREIGN
Jon> KEY (mac_pair_id) REFERENCES mac_addr_pair (id), CONSTRAINT
Jon> payload_fk FOREIGN KEY (payload_id) REFERENCES payload (id)
Jon> USING INDEX TABLESPACE indx);

Jon> Specifically, the problem is in the "ALTER TABLE meta_packet
Jon> ADD" portion of this statement. When I execute the ALTER TABLE
Jon> portion of the above statement from the SQL> prompt as follows,
Jon> I am getting this error:

SQL> ALTER TABLE meta_packet ADD
Jon> 2 ( 3 CONSTRAINT meta_packet_pk PRIMARY KEY (id), 4 CONSTRAINT
Jon> mac_pair_fk FOREIGN KEY (mac_pair_id) 5 REFERENCES mac_addr_pair
Jon> (id), 6 CONSTRAINT payload_fk FOREIGN KEY (payload_id) 7
Jon> REFERENCES payload (id) 8 USING INDEX TABLESPACE indx); USING
Jon> INDEX TABLESPACE indx) * ERROR at line 8: ORA-00907: missing
Jon> right parenthesis

Jon> Is there a syntax problem, are there too many
Jon> CONSTRAINT/REFERENCES statements or are the
Jon> CONSTRAINT/REFERENCES statements in the wrong order? I am at a
Jon> loss to understand the problem. Any ideas?

Jon> Thanks,

Missing comma at end of line 7, before line 8?

Tim
--
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you
really need to send mail, you should be able to work it out!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.