Desktop productivity for business analysts and programmers

How to find list of drugs in oracle db?

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

How to find list of drugs in oracle db?

I want to search for list of drugs in oracle database. can I list all the drugs in proc sql in where clause as below?

 WHERE (
(A.PRODUCT_DESC_1 CONTAINS ('ARIPIPRAZOLE',' ASENAPINE',BREXPIPRAZOLE)

 

I got  ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, )

 

Please help

 

Thanks,

 

 


Accepted Solutions
Solution
‎05-03-2016 09:44 AM
Esteemed Advisor
Esteemed Advisor
Posts: 7,188

Re: How to find list of drugs in oracle db?

Hi,

 

proc sql;
  select *
  from   <YOUR_TABLE> A
  where  A.PRODUCT_DESC_1 in ("ARIPIPRAZOLE","ASENAPINE","BREXPIPRAZOLE");
quit;

View solution in original post


All Replies
Esteemed Advisor
Posts: 5,194

Re: How to find list of drugs in oracle db?

CONTAINS doesn't support a list as argument. You need to combine them with OR.

Data never sleeps
Contributor
Posts: 66

Re: How to find list of drugs in oracle db?

With below code got error again:
ERROR: CONTAINS operator requires character operands.
A.PRODUCT_DESC_1 CONTAINS ('ARIPIPRAZOLE' or 'ASENAPINE' or 'BREXPIPRAZOLE').
Anything wrong?
Grand Advisor
Posts: 17,290

Re: How to find list of drugs in oracle db?

The syntax is incorrect, you need a contains for each argument, definitely a bit cumbersome. 

 

A.PRODUCT_DESC_1 CONTAINS ('ARIPIPRAZOLE') 
                                 or CONTAINS ('ASENAPINE')
                                 or ...
Solution
‎05-03-2016 09:44 AM
Esteemed Advisor
Esteemed Advisor
Posts: 7,188

Re: How to find list of drugs in oracle db?

Hi,

 

proc sql;
  select *
  from   <YOUR_TABLE> A
  where  A.PRODUCT_DESC_1 in ("ARIPIPRAZOLE","ASENAPINE","BREXPIPRAZOLE");
quit;
Contributor
Posts: 66

Re: How to find list of drugs in oracle db?

I find variations in drug name like ARIPIPRAZOLE++, ARIPIPRAZOLE
Contains brings both. I will go with contains
WHERE t1.PRODUCT_DESC_1 CONTAINS ('ARIPIPRAZOLE')
OR t1.PRODUCT_DESC_1 CONTAINS ('CLOZAPINE');
This code worked .
Thank you so much!!
Esteemed Advisor
Esteemed Advisor
Posts: 7,188

Re: How to find list of drugs in oracle db?

There are other constructs which may help you:

where XYZ like "*ABC*";

will give you all which contain the string ABC. 

 

Contributor
Posts: 66

Re: How to find list of drugs in oracle db?

I cannot list all drugs using like, right?
WHERE t1.PRODUCT_DESC_1 like ('*ARIPIPRAZOLE*','*ASENAPINE*')

Esteemed Advisor
Esteemed Advisor
Posts: 7,188

Re: How to find list of drugs in oracle db?

No, like is used for pattern matching.  Why are you looking for drug names by the way?  Should you data not be encoded with WHODrug codes - that is not only safer (you don't miss ones) its simpler as well because you can use higher level terms to bring out groups of related drugs.  Also its standard in the industry. 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 325 views
  • 1 like
  • 4 in conversation