Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > Need help with Oracle Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-24-03, 17:25
John Conklin John Conklin is offline
Registered User
 
Join Date: Apr 2003
Location: Phoenix, Arizona
Posts: 2
Need help with Oracle Error

I am trying to run the following code:

DELETE FROM DIAGNOSIS_DTL A
WHERE A.CLAIM_REF_NUM =
(SELECT B.CLAIM_REF_NUM
FROM CLAIM_SUBMISSION_INFO B
WHERE A.RECORD_TYPE=B.RECORD_TYPE AND
A.CLAIM_REF_NUM=B.CLAIM_REF_NUM AND
B.FILE_NAME='505M20030415')
AND
A.RECORD_TYPE=
(SELECT B.RECORD_TYPE
FROM CLAIM_SUBMISSION_INFO B
WHERE A.RECORD_TYPE=B.RECORD_TYPE AND
A.CLAIM_REF_NUM=B.CLAIM_REF_NUM AND
B.FILE_NAME='505M20030415');

And i keep getting the ORA-01427 error message.

Can any one tell me what is wrong with this statement?

Thanks,
John
Reply With Quote
  #2 (permalink)  
Old 04-24-03, 17:42
Hings Hings is offline
Oracle/UNIX
 
Join Date: Apr 2003
Location: Minneapolis, MN
Posts: 273
Dear John,

I guess your subquery(any one or both) returns more than 1 rows.

Try Using this one... ( Don't perform directly DELETE, first perform SELECT operation and if you r sure then and only then perform DELETE operation.)

DELETE FROM DIAGNOSIS_DTL A
WHERE A.CLAIM_REF_NUM = ANY (SELECT B.CLAIM_REF_NUM
FROM CLAIM_SUBMISSION_INFO B
WHERE A.RECORD_TYPE=B.RECORD_TYPE AND
A.CLAIM_REF_NUM=B.CLAIM_REF_NUM AND
B.FILE_NAME='505M20030415')
AND
A.RECORD_TYPE= ANY (SELECT B.RECORD_TYPE
FROM CLAIM_SUBMISSION_INFO B
WHERE A.RECORD_TYPE=B.RECORD_TYPE AND
A.CLAIM_REF_NUM=B.CLAIM_REF_NUM AND
B.FILE_NAME='505M20030415');

I guess this would help you out.

Thanks,

Hings.

==============

Still Learning...
Reply With Quote
  #3 (permalink)  
Old 04-24-03, 17:55
John Conklin John Conklin is offline
Registered User
 
Join Date: Apr 2003
Location: Phoenix, Arizona
Posts: 2
Thanks Hings,

I found another solution that works even better. In my statement where I have the = signs, I replaced them with the keyword IN. This took care of everything in one step.

John



Quote:
Originally posted by Hings
Dear John,

I guess your subquery(any one or both) returns more than 1 rows.

Try Using this one... ( Don't perform directly DELETE, first perform SELECT operation and if you r sure then and only then perform DELETE operation.)

DELETE FROM DIAGNOSIS_DTL A
WHERE A.CLAIM_REF_NUM = ANY (SELECT B.CLAIM_REF_NUM
FROM CLAIM_SUBMISSION_INFO B
WHERE A.RECORD_TYPE=B.RECORD_TYPE AND
A.CLAIM_REF_NUM=B.CLAIM_REF_NUM AND
B.FILE_NAME='505M20030415')
AND
A.RECORD_TYPE= ANY (SELECT B.RECORD_TYPE
FROM CLAIM_SUBMISSION_INFO B
WHERE A.RECORD_TYPE=B.RECORD_TYPE AND
A.CLAIM_REF_NUM=B.CLAIM_REF_NUM AND
B.FILE_NAME='505M20030415');

I guess this would help you out.

Thanks,

Hings.

==============

Still Learning...
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On