oracle pl/sql

I am a java daveloper and have poor sql skills but sometimes you come across a situation where you have to manipulate data yourslef and thats why I am here. I know this is not an oracle forum but i am hopeful since this is a basic question somebody would be able to help. I want to run the following commands together:-

ALTER TABLE employee

DROP CONSTRAINT emp_id;

ALTER TABLE employee

ADD CONSTRAINT employee_id FOREIGN KEY (

dept_id

) REFERENCES dept(

deptId

) on delete CASCADE ;

the problem is when I try to run them together it only excutes the first one and stops at the first ";", any ideas.

[672 byte] By [LisaMa] at [2007-11-26 19:59:46]
# 1

> I am a java daveloper and have poor sql skills but

> sometimes you come across a situation where you have

> to manipulate data yourslef and thats why I am here.

> I know this is not an oracle forum but i am hopeful

> since this is a basic question somebody would be

> able to help. I want to run the following commands

> together:-

>

> ALTER TABLE employee

> DROP CONSTRAINT emp_id;

>

>

> ALTER TABLE employee

>ADD CONSTRAINT employee_id FOREIGN KEY (

>dept_id

> ) REFERENCES dept(

>deptId

> on delete CASCADE ;

>

> the problem is when I try to run them together it

> only excutes the first one and stops at the first

> ";", any ideas.

How are you trying to run them together (TOAD, SQLPlus, etc.)?

jbisha at 2007-7-9 22:56:47 > top of Java-index,Java Essentials,New To Java...
# 2
that is true, I am using SQLTools for the purpose
LisaMa at 2007-7-9 22:56:48 > top of Java-index,Java Essentials,New To Java...
# 3
YOu put a slash '/' between them?
abillconsla at 2007-7-9 22:56:48 > top of Java-index,Java Essentials,New To Java...
# 4

> that is true, I am using SQLTools for the purpose

The way you have the commands should work in SQLPlus; however, I do not know SQLTools.

Example using SQLPlus in DOS:

C:\>type junk.sql

create table junk (x varchar2(10));

drop table junk;

C:\>sqlplus

...removed logon...

SQL> @junk.sql

Table created.

Table dropped.

SQL>

jbisha at 2007-7-9 22:56:48 > top of Java-index,Java Essentials,New To Java...