Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB6 Oracle
HELLO,
I m having 2 tables
[1] asset (master table with PK AID)
[2] asset_option(sub table with PK AO_ID)
[3] I wanna set bit = true of asset table whenever record deleted (default value of bit column is false)
[4] I cannot assign AID in where clause bcoz their are multiple entries of same asset with same id at front end so m using AO_ID for deleting only single record.
 

Private Sub BtnDelete1_Click()
SQL = "UPDATE (SELECT A.*,S.AO_ID From Asset A, ASSET_OPTION S"
SQL = SQL + " Where A.AID = S.AID AND AO_ID= " & Text1.Text & ")"
SQL = SQL + " SET BIT='TRUE' "
RS.Open SQL, CON, 1, 2
End Sub

 
I did this at back-end also,it shows error
SET BIT='TRUE'
*
ERROR at line 5:
ORA-01779: cannot modify a column which maps to a non key-preserved table
Posted 19-Mar-13 3:13am
surkhi623

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I Tried using another way:
 
UPDATE (SELECT A.BIT,S.AO_ID FROM Asset A, ASSET_OPTION S WHERE A.AID = S.AID) D
SET D.BIT='TRUE' WHERE D.AO_ID = (value)
 
If this doesn't work, please post ur CREATE TABLE script to help in the tests.
  Permalink  
v2
Comments
cool_sari at 20-Mar-13 1:41am
   
Sir,this command also gives same kinda error........

SQL> desc asset
Name Null? Type
----------------------------------------- -------- ------------
AID NOT NULL NUMBER(38)
ASSET_NAME VARCHAR2(50)
LOC_ID NUMBER(38)
UNIT VARCHAR2(25)
SUP_ID NUMBER(38)
BIT NOT NULL VARCHAR2(5)
 
SQL> desc asset_option
Name Null? Type
----------------------------------------- -------- ------------
IDLE_SINCE_DATE DATE
REASON_IDLE VARCHAR2(30)
UTILIZED_PERIOD DATE
FREE_ON_DATE DATE
CURRENT_STATUS VARCHAR2(50)
AID NUMBER(38)
LOC_ID NUMBER(38)
ESTIMATED_REPAIR_COST FLOAT(126)
EXPECTED_VAL FLOAT(126)
OFFER_RECEIVED FLOAT(126)
AO_ID NOT NULL NUMBER(38)
P_DATE DATE
P_COST FLOAT(126)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 475
1 Maciej Los 339
2 Richard MacCutchan 225
3 BillWoodruff 219
4 Suraj Sahoo | Coding Passion 155
0 OriginalGriff 8,759
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,269
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411028.1 | Last Updated 19 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100