Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 16th, 2013, 11:01 PM
Registered User
Join Date: Oct 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cursors - Integrity constrains

Hi Everyone;

I am new with database and I am using cursors.
I have three tables:
new_customers: customer_id, date, description, account, type, amount
customers: customer_id (PK)(FK), account(PK)(FK), type, amount
customers_history: customer_id(PK), date, description

I want to grab all the information that is on new_customers and update / save it on customers and customers_history. I have to do it with cursos (which i don't fully undestand)

My first step was with the new_customers and customers table:

CURSOR c_new_customers IS
SELECT customer_id, date, description, account, type, amount

FOR rec_newC IN c_new_customers LOOP
INSERT INTO TRANSACTION_DETAIL (customer_id, account, type, amount)
VALUES (rec_newC.customer_id, rec_newC.account, rec_newC.type, rec_newC.amount);


But I have the error ORA- 02291 Integrity constraint I know that this means that the data that I am trying to insert is an PK in another table but I don't know how to fix it.

I will appreciate the help

Similar Threads
Thread Thread Starter Forum Replies Last Post
Referntial Integrity ajabbabahalmigiriha Reporting Services 0 October 26th, 2007 11:02 AM
xml referential integrity mescalito XML 0 December 10th, 2004 08:33 AM
Referential Integrity owain SQL Language 2 May 12th, 2004 03:36 AM
Pivot Table integrity cmquinn Excel VBA 0 June 23rd, 2003 06:25 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.