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 > Oracle merge problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-03-03, 13:26
AlanP AlanP is offline
Registered User
 
Join Date: Mar 2002
Location: Reading, UK
Posts: 1,098
Oracle merge problem

I cant get this merge command to work in a stored proc (Oracle 9.0.1). It works fine in SQLPlus but not in the stored proc where it throws up an ORA-1790: expression must have same datatype as corresponding expression ORA-6512. Anyone got any clues?

CREATE OR REPLACE PROCEDURE DEALERPROFILE_UPDATE(netid number,bikes_yn char, bodyshop_yn char, LABOURGPANALYSIS_YN char, MINI_YN char, OTHER_YN char, PARTSRGPANALYSIS_YN char) IS
BEGIN
merge into networkentityitemgroupoption x
using (
select netid networkentity_id, 449 itemgroup_id, BIKES_YN selected from dual union
select netid networkentity_id, 395 itemgroup_id, BODYSHOP_YN selected from dual union
select netid networkentity_id, 303 itemgroup_id, LABOURGPANALYSIS_YN selected from dual union
select netid networkentity_id, 363 itemgroup_id, LABOURGPANALYSIS_YN selected from dual union
select netid networkentity_id, 192 itemgroup_id, MINI_YN selected from dual union
select netid networkentity_id, 249 itemgroup_id, MINI_YN selected from dual union
select netid networkentity_id, 454 itemgroup_id, OTHER_YN selected from dual union
select netid networkentity_id, 259 itemgroup_id, PARTSRGPANALYSIS_YN selected from dual union
select netid networkentity_id, 269 itemgroup_id, PARTSRGPANALYSIS_YN selected from dual
) y
on (x.networkentity_id=y.networkentity_id and x.itemgroup_id=y.itemgroup_id)
when matched then update set x.selected=y.selected
when not matched then insert (x.networkentity_id, x.itemgroup_id, x.selected) values (y.networkentity_id, y.itemgroup_id,y.selected);
END DEALERPROFILE_UPDATE_TRIG;
/


CREATE TABLE NETWORKENTITYITEMGROUPOPTION (
NETWORKENTITY_ID NUMBER (38) NOT NULL,
ITEMGROUP_ID NUMBER (38) NOT NULL,
SELECTED CHAR (1),
CONSTRAINT NETENTITYITEMGROUPOPTION_PK
PRIMARY KEY ( NETWORKENTITY_ID, ITEMGROUP_ID )
USING INDEX TABLESPACE INDX_SMALL PCTFREE 10
)
TABLESPACE DATA_SMALL
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