Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

The EXISTS Method. Compare objects for equal.

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
Caputo
Asked:
Caputo
  • 4
  • 3
1 Solution
 
sdstuberCommented:
please post the code too
0
 
CaputoAuthor Commented:
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
 
sdstuberCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
CaputoAuthor Commented:
I am trying to determine if the data in element stat (x) exists-matches anywhere in the_list table
0
 
sdstuberCommented:
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
 
CaputoAuthor Commented:
Thank you,
0
 
sdstuberCommented:
glad I could help
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now