Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: oracle sqlplus Post Reply Post New Topic
Author Message
mahenry
Newbie
Newbie


Joined: 26 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
Quote mahenry Replybullet 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 IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 27 Feb 2008 at 6:20am
Hi,
 
Try creating view  and use that.....
 
Cheers
Rahul
IP IP Logged
mahenry
Newbie
Newbie


Joined: 26 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
Quote mahenry Replybullet Posted: 27 Feb 2008 at 1:05pm
CrySorry, I don't follow you.
mhenry
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet 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 IP Logged
mahenry
Newbie
Newbie


Joined: 26 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
Quote mahenry Replybullet 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 IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet 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 IP Logged
mahenry
Newbie
Newbie


Joined: 26 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
Quote mahenry Replybullet 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 IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 28 Feb 2008 at 9:42am
Cool.  Yes, the native Oracle connection is MUCH better than going through ODBC.
 
-Dell
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum