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]

> 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.)?
> 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>