473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem in on delete no action why?

while i am trying to execute the following query it shows error. i need to create such type relation between 3 table. here i am showing example. this also show error.
Expand|Select|Wrap|Line Numbers
  1. create table tbl1(
  2.     id1    number primary key,
  3.     name1    varchar2(10)
  4. );
  5.  
  6. create table tbl2(
  7.     id2    number,
  8.     name2    varchar2(10) primary key);
  9.  
  10. create table tbl3(
  11.     id3    number,
  12.     name3    varchar2(10),
  13.     foreign key (id3) references tbl1(id1),
  14.     foreign key (name3) references tbl2(name2) on delete no action
  15. );
  16.  
but when i run the following code it shows no error
Expand|Select|Wrap|Line Numbers
  1. create table tbl1(
  2.     id1    number primary key,
  3.     name1    varchar2(10)
  4. );
  5.  
  6. create table tbl2(
  7.     id2    number,
  8.     name2    varchar2(10) primary key);
  9.  
  10. create table tbl3(
  11.     id3    number,
  12.     name3    varchar2(10),
  13.     foreign key (id3) references tbl1(id1),
  14.     foreign key (name3) references tbl2(name2) on delete cascade
  15. );
why?????
Jul 20 '10 #1
6 7762
rski
700 Expert 512MB
and the error is ...
Jul 20 '10 #2
Expand|Select|Wrap|Line Numbers
  1. and the error is ... 
probably something like "ON DELETE NO ACTION is no combination of keywords Oracle supports. Please look up the CREATE TABLE statement ..."
Jul 20 '10 #3
rski
700 Expert 512MB
@magicwand
I think there is ON DELETE NO ACTION
http://download.oracle.com/docs/cd/E....htm#CNCPT1649
Jul 20 '10 #4
Oralloy
988 Expert 512MB
I may be confused here, but I think you're mistaking the "DELETE NO ACTION" DML statement for the "ON DELETE NO ACTION" clause.

This link was on the page you gave. It referrs to the "On Delete" clause.
Jul 20 '10 #5
@rski:

oops, never noticed that.

Sorry ...
Jul 20 '10 #6
amitpatel66
2,367 Expert 2GB
Its not required to say "ON DELETE NO ACTION" because oracle supports ON DELETE CASCADE/ON DELETE SET NULL and if you do not specify ON DELETE CASCADE or ON DELETE SET NULL, by default it is set to "NO ACTION".

Try this:

Expand|Select|Wrap|Line Numbers
  1. create table tbl3( 
  2.     id3    number, 
  3.     name3    varchar2(10), 
  4.     foreign key (id3) references tbl1(id1), 
  5.     foreign key (name3) references tbl2(name2)); 
  6.  
The above code will by default behave as "ON DELETE NO ACTION"
Jul 21 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: D. Dante Lorenso | last post by:
I'd like to run a clean up command on my tables to eliminate rows that I'm no longer using in the database. I want to do something like this: DELETE FROM tablename WHERE...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
3
by: Rabbit | last post by:
Hi, I'm having a GridView with Datasource being set from CodeBehind method, its has a "RecID" databound field set as invisible. I want to utilize the "Delete" commandfield, so that on...
5
by: morz | last post by:
classA { public: thirdPartyThreadLibrary myThread; void Run() { myThread.exec(); // created new thread and run on background. }
3
by: Jeff | last post by:
In a subform I have a simple SQL statement that links an order details table to a product table. The form is used to enter order details. Most fields are obviously from the details table, with only...
10
by: amiga500 | last post by:
Hello, I have one basic simple question. When I have multiple records in the datagrid as follows: Code Product 1 Product 2 Product 3 11111 A B C...
17
by: gnawz | last post by:
Hi I have a drop down thus <form name = frmUtils method = POSTaction = ""> <select name = Do> <option>Add</option> <option>Delete</option> <option>Update</option>
5
by: jasone | last post by:
Hi all, im nearly there with this one and im sure it shouldnt be hard to solve, i just cant seem to find the solution. ive got records being displayed, the user can then tick what records to...
8
by: jasone | last post by:
Hi all, im nearly there with this one and im sure it shouldnt be hard to solve, i just cant seem to find the solution. ive got records being displayed, the user can then tick what records to...
1
by: anish5000 | last post by:
Hi, I have a page abc.jsp...(the page includes strut2 tags s: ) <s:url id="delete" action="delete" > <s:param name="proj.id" value="id" /> </s:url> <s:a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.