Solved

SQL Expression for 8.5

Posted on 2004-10-15
9
1,433 Views
Last Modified: 2008-02-26
I challenge any EEE to please provide me with a tried and proven simple Oracle select statement in a SQL Expression Editor that returns a sum() via a direct Crystal Reports Oracle Server database connection.

e.g.    select sum(amount_balance) from accounting_finrep  

I am using Crystal Reports 8.5 Developers edition on Oracle 9.2.0.1.0

I have read all recommendations in the entire universe regarding this problem and none of them work.
I continually receive ORA-????? errors without end.  Please help.

Thank Yee.
0
Comment
Question by:Spareyarn
  • 4
  • 4
9 Comments
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 12322985
I don't have Oracle installed locally, but you should be able to use:

(
SELECT DISTINCT
  SUM(account_balance)
FROM
  accounting_finrep
)

Copy the above expression and paste it into your query editor (SQL+, Toad, Embarcadero, etc..).  If the query runs in the editor, it should be good in Crystal Reports.  One key factor is that you have to encapsulate this type of query in parentheses within the SQL Expression Editor.

~Kurt
0
 

Author Comment

by:Spareyarn
ID: 12323217
The SQL syntax you provided is correct and works fine in Toad, PL/SQL Developer, SQL*Plus etc...  
However, the syntax does not compile in the SQL Expression editor in CR8.5.

I receive "ORA-01007 variable not in select list" error message, then a subsequent CR error message stating invalid sql-cannot compile.  

I have tried many options trying to get this to work, encapsulation with parenthesis, {}, " "...and none work.  I either recieve ora-00904 or ora-01007.  Other than the SQL Expression editor, CR8.5 works fine with the Oracle database views, tables, joins and stored procedures.

One other note, the "account_balance" is a field in the report JIC that was your next suggestion.

Thanks for the help, I'll keep trying the same thing over and over again...it has to work eventually ;->
0
 
LVL 13

Expert Comment

by:EwaldL
ID: 12323397
you can't use a select statement in an sql expression. sql expression can only manipulate fields, they can't return whole rows. they can be used for instance for concat or trim.

here is more info
http://support.businessobjects.com/communityCS/TechnicalPapers/sqlexpressions.pdf.asp
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 12323662
ewaldl, that's incorrect.  I use Select statements in SQL Expressions all the time.

You CAN use select statements in SQL Expressions.  In fact, you can have a highly complex and convoluted SQL statement.  The caveats are that you must encapsulate the Select statement in parentheses and the SQL Expression can only return a single distinct value.  A SQL Expression is passed to the database as a subquery field in the SELECT clause of the Crystal SQL statement.

Check out the following thread:

http://www.experts-exchange.com/Databases/Crystal_Reports/Q_21161031.html

Spareyarn,  how are you connecting to the database?  Merant ODBC, Native Drivers, etc...  SQL Expressions depend upon the database connection.

~Kurt
0
 

Author Comment

by:Spareyarn
ID: 12323743
Native Oracle Server drivers provided with CR8.5

p.s.  thanks for saving me the longwinded response I was cooking up for ewaldl.
0
 
LVL 26

Assisted Solution

by:Kurt Reinhardt
Kurt Reinhardt earned 50 total points
ID: 12324236
Have you tried switching drivers?  You're getting oracle-specific errors, which could indicate issues with the driver.  Then again, I've found SQL Expressions to be kind of iffy with Oracle in some cases.

What is the report data source?  A View, Stored Procedure, Tables, etc...

~Kurt
0
 
LVL 26

Accepted Solution

by:
Kurt Reinhardt earned 50 total points
ID: 12324275
Also, here's a Business Objects KB article which discusses the error message you're getting, specific to your version of Crystal Reports:

http://support.businessobjects.com/library/kbase/articles/c2012294.asp

~Kurt
0
 

Author Comment

by:Spareyarn
ID: 12324868
Unfortunately, I don't have a choice when it comes to what db driver to use.  The report, once finished, will be plugged into an ERP Application (Industrial and Financial Systems-IFS) that only supports direct Oracle connections, not ODBC.  

The article you posted looks promising, I will apply CR8.5 SP3 and see what happens.

Thanks for your help.

0
 

Author Comment

by:Spareyarn
ID: 12324915
Case Closed!!!

SP3 fixed it, thank you very much.  I can now sleep a happy man.  

Probably should've looked in more detail for CR8.5 updates, instead of syntax validation on the good ole world wide web.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 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