?
Solved

The EXISTS Method. Compare objects for equal.

Posted on 2009-03-31
7
Medium Priority
?
329 Views
Last Modified: 2013-12-18
Here is some psuedo code. I am trying to determine if an element exists in an object. However every variation on the comparison type format brings an error.
0
Comment
Question by:Caputo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 24028842
please post the code too
0
 

Author Comment

by:Caputo
ID: 24028899
Sorry, that the second time thats happened here. I use the code snippet, review and submit and it doesnt come thru. Any way here it is,

CREATE OR REPLACE TYPE STAT_OBJ AS OBJECT
(
  CLT_DOC       VARCHAR2(6 BYTE),
  CLT_LSTNM     VARCHAR2(19 BYTE),
  CLT_FSTNM     VARCHAR2(10 BYTE),
  CSE_CRT_NUM   VARCHAR2(9 BYTE),
  CSE_CSE_ID    CHAR(1 BYTE),
  CSE_SEQ_NM    NUMBER(2),
  CSE_OFF_TYP   CHAR(1 BYTE),
  OFF_STAT      VARCHAR2(26 BYTE),
  CSE_STS_SEQ   NUMBER(2),
  OFF_HST_STAT  VARCHAR2(26 BYTE),
  CSE_STS       VARCHAR2(2 BYTE),
  STATUS_DT     NUMBER(8),
  REPORT        VARCHAR2(100 BYTE)
);
CREATE OR REPLACE TYPE STAT_T AS TABLE OF STAT_OBJ;

stat stat_t;
the_list stat_t;

IF the_list.EXISTS(stat (x)) THEN

    null;
   
END IF;


PLS-00306: wrong number or types of arguments in call to 'EXISTS'
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 24029060
what are you trying to determine exists?

you have 2 tables   "the_list" and "stat"

to determin if element 10 exists you would do...

the_list.exists(10)
or
stat.exists(10)

you are using checking if element number "stat(x)"  exists with "the_list

but stat(x) isn't a number, it's another object (of type stat_obj)

what is it you are trying to do with "stat(x)"  ?





0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:Caputo
ID: 24029151
I am trying to determine if the data in element stat (x) exists-matches anywhere in the_list table
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 24029690
ah...

ok for that you will have to iterate though the_list and check each element yourself

for i in 1..the_list.count loop
    IF stat(x).clt_doc = the_list(i).clt_doc
   AND stat(x).clt_lstnm = the_list(i).clt_lstnm
   AND stat(x).clt_fstnm = the_list(i).clt_fstnm
   AND stat(x).cse_crt_num = the_list(i).cse_crt_num
   AND stat(x).cse_cse_id = the_list(i).cse_cse_id
   AND stat(x).cse_seq_nm = the_list(i).cse_seq_nm
   AND stat(x).cse_off_typ = the_list(i).cse_off_typ
   AND stat(x).off_stat = the_list(i).off_stat
   AND stat(x).cse_sts_seq = the_list(i).cse_sts_seq
   AND stat(x).off_hst_stat = the_list(i).off_hst_stat
   AND stat(x).cse_sts = the_list(i).cse_sts
   AND stat(x).status_dt = the_list(i).status_dt
   AND stat(x).report = the_list(i).report
    THEN
        matches := 'Yes';
    END IF;
end loop;
0
 

Author Closing Comment

by:Caputo
ID: 31564806
Thank you,
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 24029866
glad I could help
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Disruption" is the most feared word for C-level executives these days. They agonize over their industry being disturbed by another player - most likely by startups.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question