| Author |
Message |
mahenry
Newbie
Joined: 26 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
|

Topic: oracle sqlplus Posted: 26 Feb 2008 at 5:36pm |
I am new to crystal reports and I have created a query in oracle sqlplus that works great but when I plug it into the command option in Crystal XI, it doesn't work - no matter how I tweak it. Any help would be welcomed.
This is from sqlplusw, the portion in red is where I am having trouble:
SELECT
PERSON.SEARCHNAME,
PERSON.DATEOFBIRTH,
PERSON.EXTERNALID,
RPTOBS.HDID,
RPTOBS.OBSDATE,
RPTOBS.OBSVALUE,
PROBLEM.PID,
PROBLEM.CODE,
LOCREG.ABBREVNAME
FROM
PERSON,
PROBLEM,
RPTOBS,
LOCREG
WHERE
PERSON.HOMELOCATION = LOCREG.LOCID
AND LOCREG.ABBREVNAME in ('APNCAS2', 'APNCCL')
AND PERSON.PID = PROBLEM.PID
AND PROBLEM.PID NOT IN (SELECT DISTINCT PID
FROM PROBLEM
WHERE CODE IN ('ICD-V17.5',
'ICD-493.92',
'ICD-493.91',
'ICD-493.90',
'ICD-493.82',
'ICD-493.81',
'ICD-493.22',
'ICD-493.21',
'ICD-493.20',
'ICD-493.12',
'ICD-493.10',
'ICD-493.02',
'ICD-493.01',
'ICD-493.00'))
AND PERSON.PID = RPTOBS.PID
AND RPTOBS.HDID = 105310
AND RPTOBS.OBSVALUE >'2'
AND TO_CHAR(PERSON.DATEOFBIRTH, 'YYYY') >= TO_CHAR(SYSDATE - NUMTOYMINTERVAL(50, 'YEAR'), 'YYYY')
AND TO_CHAR(PERSON.DATEOFBIRTH, 'YYYY') <= TO_CHAR(SYSDATE - NUMTOYMINTERVAL(12, 'YEAR'), 'YYYY')
|
|
mhenry
|
IP Logged |
|
|
|
rahulwalawalkar
Senior Member
Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
|

Posted: 27 Feb 2008 at 6:20am |
Hi,
Try creating view and use that.....
Cheers
Rahul
|
IP Logged |
|
mahenry
Newbie
Joined: 26 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
|

Posted: 27 Feb 2008 at 1:05pm |
 Sorry, I don't follow you.
|
|
mhenry
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|

Posted: 27 Feb 2008 at 2:36pm |
What's the error that you get?
A View is a structure in the database itself that looks like a table but it actually runs a query in the background. If you don't have DBA access to your database then one of your DBAs would have to set it up.
-Dell
|
|
|
IP Logged |
|
mahenry
Newbie
Joined: 26 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
|

Posted: 27 Feb 2008 at 3:53pm |
|
I'm not allowed to alter anything in the database. It is owned by GE andwe cannot alter the tables. I can only query to get information for the reports. I need some clarification. Are you saying that Crystal Reports cannot define a datasource which includes a nested query in the WHERE clause for the purpose of eliminating undesire records? I need to do this in Crystal Reports!
|
|
mhenry
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|

Posted: 28 Feb 2008 at 5:54am |
|
You should be able to. Rahul's response was the common solution to this type of problem, but there are others. What is the exact error that you're getting in Crystal?
|
|
|
IP Logged |
|
mahenry
Newbie
Joined: 26 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
|

Posted: 28 Feb 2008 at 9:16am |
I figured it out, I was using the ODBC option and connecting to the database that way. I noticed an Oracle server option and used that one and now the sql query works.
thanks so much.
|
|
mhenry
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|

Posted: 28 Feb 2008 at 9:42am |
Cool. Yes, the native Oracle connection is MUCH better than going through ODBC.
-Dell
|
|
|
IP Logged |
|
|
|