Get Error on using Stored Procedure to use it in Crystal Reports XI
Post Author: Krüger
CA Forum: Integrated Solutions
Hello, I need your help please. I use Oracle 10 and now write a correct compiled stored procedure: this procedure is really simple how you can see:set pagesize 50000set linesize 1000set wrap offset head offset feedback offset trimspool onset serveroutput onset verify offcreate or replace procedure GetFirmenNachMontag is lutype varchar2(10);BEGINDECLAREbegin lutype:='Test'; dbms_output.put_line(lutype);END;END; In using in sql directly it is really all fine. But when I want to integrat it in a simple report in Crystal I get the error unknow databank connector error. I hope that somebody can help me please. With best regardsM.Krüger
If you are using MSSQL SERVER then try creating a stored procedure like this
create proc Name
select * from Table
by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
here is the syntax to create SP
Syntax
CREATE PROC [ EDURE ] procedure_name [ ; number ]
[ { @parameter data_type }
[ VARYING ] [ = default ] [ OUTPUT ]
] [ ,...n ]
[ WITH
{ RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
[ FOR REPLICATION ]
AS sql_statement [ ...n ]
Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
Regards,
Raghavendra
Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM
Similar Messages
-
Stored Procedure for displaying data in Crystal Reports
Hi I am new to Oracle & Crystal Reports,so can any one please give me sample stored procedure to display data in Crystal report from Oracle by passing rwo input values.
from site:-
Crystal Reports will only support the return of a single refcursor from Oracle. Even the latest and greatest version 10 doesn't allow you to return more than one recordset at a time. You could add one more step to your procedure that would join up the output of the multiple refcursors into a PL/SQL table and then fetch the result set out through a single refcursor. That way you are using temporary space that will be cleaned up as soon as the connection is terminated and will only be returning a single refcursor -
How to use a stored procedure as a datasource in Crystal Report for Eclipse
Hi All,
I've written a stored procedure in oracle 10g with few input parameters and one refcursor output parameter. I want to use this stored procedure as a data source for creating a report in "Crystal Report For Eclipse 3.6.0".
When I tried to add this stored procedure to the report using the connection explorer, I don't see any option to do this. But when I try to add any table, it shows options like "Add to the current report"....
Can anybody assist me how to use a stored procedure as a data source in "Crystal Report For Eclipse"?
Which driver should I use to connect to the oracle database? I tried using JDBC Driver for Oracle.
Thanks in advance.Did you solve your problem? How did you do?
-
Getting error when calling stored procedure
I have created 2 stored procedures as follows
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[REAL_PUSH_UPDATE_REPORTS] AS
BEGIN TRANSACTION
DECLARE @cursor_contact_id bigint;
DECLARE cursorContactId Cursor FOR SELECT distinct(contact_id) FROM [dbo].credit_reports WHERE loan_id IS NULL;
OPEN cursorContactId;
Fetch NEXT FROM cursorContactId INTO @cursor_contact_id;
IF(@@FETCH_STATUS <> 0)
PRINT 'There are no LOAN contacts are there with loan ID null, May be you have already executed this procedure'
WHILE(@@FETCH_STATUS =0)
BEGIN
PRINT @cursor_contact_id;
EXECUTE REAL_UPDATE_REPORTS @cursor_contact_id;
Fetch NEXT FROM cursorContactId INTO @cursor_contact_id
END
CLOSE cursorContactId;
DEALLOCATE cursorContactId;
IF (@@Error = 0)
BEGIN
COMMIT TRANSACTION;
END
ELSE
BEGIN
ROLLBACK TRANSACTION;
END
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[REAL_UPDATE_REPORTS] @initial_contact_id bigint AS
BEGIN TRANSACTION
DECLARE @loan_count bigint;
DECLARE cursorLoanID Cursor FOR (SELECT l.loan_id loanIDList FROM (([dbo].loans l LEFT OUTER JOIN [dbo].loan_requests lr
ON lr.loan_id=l.loan_id
AND lr.contact_id = l.primary_borrower_id)
LEFT OUTER JOIN [dbo].loan_codes lc
ON l.loan_code_id = lc.loan_code_id)
WHERE (l.primary_borrower_id=@initial_contact_id)
AND l.active=1 UNION SELECT l.loan_id
FROM [dbo].loans l LEFT OUTER JOIN [dbo].loan_requests lr
ON lr.loan_id=l.loan_id LEFT OUTER JOIN [dbo].contacts c
ON c.contact_id =l.primary_borrower_id
WHERE (l.loan_id IN
(SELECT cb.loan_id FROM coborrowers cb where contact_id =@initial_contact_id and active = 1))
UNION
SELECT l.loan_id
FROM [dbo].loans l LEFT OUTER JOIN [dbo].loan_requests lr
ON lr.loan_id=l.loan_id LEFT OUTER JOIN [dbo].contacts c
ON c.contact_id =l.primary_borrower_id
WHERE (l.loan_id IN (SELECT cs.loan_id
FROM cosigners cs where contact_id =@initial_contact_id and active = 1)) UNION
SELECT g.loan_id FROM [dbo].groups g, [dbo].group_members gm,
[dbo].loan_requests lr WHERE gm.group_id = g.group_id
AND lr.loan_id = g.loan_id
AND lr.contact_id = gm.secondary_borrower_id
AND gm.secondary_borrower_id=@initial_contact_id and gm.active = 1)
ORDER BY loanIDList DESC;
OPEN cursorLoanID;
SET @loan_count = @@CURSOR_ROWS;
PRINT @loan_count;
IF(@loan_count > 0) BEGIN
DECLARE @loans_loan_id bigint;
Fetch NEXT FROM cursorLoanID INTO @loans_loan_id;
DECLARE @my_count bigint;
SET @my_count=1;
WHILE(@@FETCH_STATUS =0)
BEGIN
DECLARE @temp_contact_id bigint;
DECLARE @temp_loan_id bigint;
SET @temp_contact_id = @initial_contact_id;
SET @temp_loan_id = @loans_loan_id;
IF(@my_count=@loan_count)
BEGIN
UPDATE [dbo].credit_reports SET loan_id = @temp_loan_id WHERE
loan_id IS NULL AND contact_id = @initial_contact_id
AND NOT EXISTS (SELECT * FROM [dbo].credit_reports
WHERE contact_id = @initial_contact_id AND
loan_id=@temp_loan_id);
END
ELSE
BEGIN
INSERT INTO [dbo].credit_reports(contact_id,credit_bureau_id, credit_score, thirty_days_late,
sixty_days_late, ninety_days_late, currently_negative, amount_past_due,
inquiries_six_mos, public_records, collections, total_accounts_balance,
total_mthly_pymts, report_file, report_gu_id, data_entry_by, data_entry_date,
loan_id) SELECT contact_id,credit_bureau_id, credit_score, thirty_days_late,
sixty_days_late, ninety_days_late, currently_negative, amount_past_due,
inquiries_six_mos, public_records, collections, total_accounts_balance,
total_mthly_pymts, report_file, report_gu_id, data_entry_by,
data_entry_date,@temp_loan_id FROM [dbo].credit_reports WHERE contact_id
= @initial_contact_id AND loan_id IS NULL
AND NOT EXISTS (SELECT * FROM
[dbo].credit_reports WHERE contact_id=@initial_contact_id AND
loan_id=@temp_loan_id);
END
Fetch NEXT FROM cursorLoanID INTO @loans_loan_id;
SET @my_count = @my_count + 1;
END
close cursorLoanID
deallocate cursorLoanID
IF (@@Error = 0)
BEGIN
COMMIT TRANSACTION;
PRINT 'Success for contactID :'+CONVERT(varchar(50),@initial_contact_id);
END
ELSE
BEGIN
ROLLBACK TRANSACTION;
PRINT 'Failed for contactID :'+CONVERT(varchar(50),@initial_contact_id);
END
END
ELSE
BEGIN
ROLLBACK;
PRINT 'NO Loans For the contactID :'+CONVERT(varchar(50),@initial_contact_id);
ENDnow the problem is
i have executed 2 procedures saperately thn its ok while im calling im getting
Msg 16915, Level 16, State 1, Procedure REAL_UPDATE_REPORTS, Line 5
A cursor with the name 'cursorLoanID' already exists.
Msg 16905, Level 16, State 1, Procedure REAL_UPDATE_REPORTS, Line 6
The cursor is already open.Please let me know the reason...
Thank you.
Message was edited by:
User71408What the heck, that's fun..
I for one, have never seen T-sql or whatever it's called.
Looking at it, it seems that a
close cursorLoanID
deallocate cursorLoanID
is missing from the ELSE section doing the rollback.
But, only guessing
Fun, fun, fun -
Fields in Stored Procedure does not appear in Crystal reports 2008.
hi,
I am now using crystal reports 2008 evaluation copy for 30 days. I am trying to create a stored procedure with parameter, here is my sample Stored Procedure code;
DELIMITER $$
DROP PROCEDURE IF EXISTS `puerto`.`SP_FindEmployees`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `SP_FindEmployees`(SIDNo VARCHAR(10))
BEGIN
SELECT * FROM employees WHERE IDNo=SIDNo;
END$$
DELIMITER ;
when i try to call the procedure in sqlyog here is my sample code;
CALL sp_findemployees('0000000001')
it is successfull, but when i try to connect it with crystal reports 2008 I got no fields in my stored procedure andi got this error message ;
"Database Connector: 'HY00:[MySQL][ODBC 3.51 Driver][mysqld-5.1.33-community]incorect number of arguments for procedure puerto.sp_findemployees; expected 1, got 0 [Database vendor code: 1318]"
CR2008 was not asking a parameter values.
But when I try using stored procedure that i've made in MSSQL, CR2008 asking parameters and succefully created the reports needed.
My Objective is to make a stored procedure in MySQL by using select statement and filter it with parameter(s) that I will pass and CR2008 will use this stored procedure.
i also try the view with this code below and it was successfull in CR2008.
DELIMITER $$
DROP VIEW IF EXISTS `puerto`.`ep_employees`$$
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ep_employees` AS (SELECT `employees`.`IDNo` AS `IDNo`,`employees`.`FullName` AS `FullName` FROM `employees`)$$
DELIMITER ;hi,
Crystal Reports 2008 and MySQL 5 , ODBC driver 3.5 and ODBC driver 5.1.
I use ODBC connector 3.5 because I got errors in ODBC drivers in 5.1.
Do you have step by step procedure for creating add command dialog box?
I try creating the add command dialog box
here's my sample sql statement i don't know if its correct because no data appearing in my crystal report
Select * from employees where idno=@IDNo
in Command Parameter Dialog Box
Parameter Name = @IDNo
Prompting Text = @IDNo
Value Type = String
DefaultValue = 0
thanks! -
Error connecting to stored procedure in crystal report
Hello
I'm using crystal reports 2008 with the latest service pack.
i'm trying to access stored procedure using the mysql jdbc driver 5.17. The crystal report has been designed which works fine with a login that created the stored procedure but when i try to run with another login that will used to run the crystal reports
The login has access to execute the stored procedure but entered in the crystal report it complains about
"User does not have access to metadata required to determine stored procedure parameter types. If rights cannot be granted, configure with {noAccessToProcedureBodies=true} to have driver generate parameters that represent INOUT strings irregardless of actual paramter types"Hi Sharon
Thanks for response.
I have checked that the user has permission to read and write. When i try and execute the stored procedure in the database by login with the user, it runs fine.
When i try and call the stored procedure from crystal reports it throws that error message.
regards
Naresh -
How to create a stored procedure and use it in Crystal reports
Hi All,
Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
Thanks in advance.If you are using MSSQL SERVER then try creating a stored procedure like this
create proc Name
select * from Table
by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
here is the syntax to create SP
Syntax
CREATE PROC [ EDURE ] procedure_name [ ; number ]
[ { @parameter data_type }
[ VARYING ] [ = default ] [ OUTPUT ]
] [ ,...n ]
[ WITH
{ RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
[ FOR REPLICATION ]
AS sql_statement [ ...n ]
Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
Regards,
Raghavendra
Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM -
I have create Logic App under Azure App Services, I am getting
error while using HTTP connector and calling POST action to a Web API which is deployed as website on Azure.
Following are the screen shots:
Login App Connector Diagram:
hemaMarking as answered since no response on request for more information - assuming that you found what was wrong in the inputs. Let us know if you're still having trouble.
http://twitter.com/joshtwist -
ERROR-Logging of Stored Procedure (Stop / Going on after error + logging)
Hi @all,
I am using a Stored Procedure which is very simple:
=>The stored procedure is selecting many tousands of records from table1 + table2.
=> Some values (records) will be summarized (aggregated/group by).
=>After this selection and summarizing, this records will be deleted from table3 (if they exist in table3).
=>Then the selected records will be inserted in table3.
Now I want to do the following:
Is there a way to log the errors of the stored procedure?
For example, the stored procedure is copying many thousands of records.
If there is a problem on copying/ inserting a record to table3, then I want a error-log in a loggin_table.
Is there a way to write the error-logs from a stored procedure to a special table in database?
I want to do this in 2 ways:
1) On error the error is logged and the stored procedure is stopped.
2) On error the error is logged and the stored procedure is going on to insert/summarize the next record.
I don't know how I can get these errors of a stored procedure. Maybe it isn't possible? Or is it better to use a function?
Hope anyone can give me a hint?
Thanks a lot.
Best regards,
TimHi
option one:
as i know you can have another table without primer key (log table).
then before you insert into table, select the record count using primary key. if it is duplicate then put those record into the table.
option two:
write the log into file.
declare
f utl_file.file_type;
s varchar2(200);
begin
f := utl_file.fopen('SAMPLEDATA','sample1.txt','R');
loop
utl_file.get_line(f,s);
dbms_output.put_line(s);
end loop;
exception
when NO_DATA_FOUND then
utl_file.fclose(f);
end;
refer : http://www.psoug.org/reference/OLD/utl_file.html
regards
upul.
Edited by: Upul Indika on Apr 9, 2009 12:45 PM -
Howto get information about Java Stored Procedures programmaticly
Hi all,
using the DatabaseMetaData object it is easily possible to get information about database objects like tables, columns or even plsql stored procedures.
But is there a way to get information about Java Stored Procedures which are published in packages ? Is it possible here to use a DatabaseMetaData object or is there any other solution ?
TIA,
ChrisWhat sort of information do you want to know about the Java stored procedures?
Would the views USER_SOURCE or USER_OBJECTS contain the information you need? -
How to get a resultset from Stored Procedures
How to efficiently and portably get resultsets from Oracle stored procedures? Oracle does not seem to follow JDBC standards here. A standard way in Oracle is to use a ref cursor and call getObject() on CallableStatement. However, Oracle seems to get all the data in the resultset in getObject(), which is inefficient and leads to large memory usage when the resultset is large.
Another way in Oracle is to use getCursor() on an OracleCallableStatement, which is efficient but not portable across different application servers. For example, in WebSphere, this OracleCallableStatement is not available if we want WebSphere to manager the datasource.
Any ideas will be greatly appreciated. Please email to [email protected]Oracle JDBC did not support return a result set, if you are using Oracle 9i, you can use pipeline function, then using the TABLE() function the get the row.
Good Luck.
Welcome to http://www.anysql.net/en/ -
Get error messages for those procedures in some system tables
Hi expert,
when I ran a procedure by schedule or on the front end. is there any approach to get error messages for those procedures in some system tables?
Many Thanks,>
when I ran a procedure by schedule or on the front end. is there any approach to get error messages for those procedures in some system tables?
>
No - there is no system log table.
You need to create your own logging package and log table and modify your procedure code to call your own logging procedures to log into your own log table.
The procedures in the log package would typically be defined with PRAGMA AUTONOMOUS_TRANSACTION so that the exceptions get logged even if your procedure performs a ROLLBACK.
See AUTONOMOUS_TRANSACTION in the PL/SQL Language Reference
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/autotransaction_pragma.htm
Here is an Oracle-Base article that shows how to use the pragma to perform logging.
http://www.oracle-base.com/articles/misc/autonomous-transactions.php -
Getting a DataReader by stored procedure vs. SQL statment (Performance)
Hallo DB-Experts,
I have encountered a performance problem regarding getting a DataReader by stored procedure versus a SQL statment
and I want to know if this is an known issue and how to tune it.
Getting a DataReader through a SQL statment is faster than with a stored procedure,
if the number of data rows are less than about 8000 datarows, although we are using an index.
The stored procedure ist only faster about 8000 datarows.
For the first 20 rows the different is between 50 abd 20 percent and between and 20 and 2000 rows it fall down to 10 percent.
Over 8000 rows the stored procedure is faster!
The time series table looks like:
CREATE TABLE TimeSeries
OBJECT_ID NUMBER(8) NOT NULL,
UNIVERSAL_TIME NUMBER(10) NOT NULL,
LOCAL_TIME DATE NOT NULL,
MOD_TIME NUMBER(10),
USERID NUMBER(10),
VALUE NUMBER NOT NULL,
FLAG NUMBER(2) DEFAULT 0 NOT NULL
The foreinkey is object_id and another index is for universal_time and mod_time
The stored procedure looks like:
PROCEDURE SELECTDATA_UT_MOD (pObjectID IN NUMBER,
pType IN VARCHAR2,
pTable IN VARCHAR2,
pFrom IN NUMBER,
pTo IN NUMBER,
IO_CURSOR OUT T_CURSOR)
IS
SQLString VARCHAR2(1024);
BEGIN
IF pOBJECTID <> 0 THEN
CASE
WHEN UPPER(pTYPE)='A' THEN
SQLString := 'SELECT UNIVERSAL_TIME, VALUE, FLAG, MOD_TIME FROM ' || pTABLE || ' WHERE OBJECT_ID = :t1 AND UNIVERSAL_TIME >= :t2 and UNIVERSAL_TIME < :t3 Order By UNIVERSAL_TIME, MOD_TIME DESC';
OPEN IO_CURSOR FOR
SQLString USING pOBJECTID,pFROM,pTO;
END IF;
END;
The SQL statment for the data reader looks like:
SELECT d.universal_time, d.VALUE, d.flag, 0 AS mod_time
FROM daten d
WHERE object_id = 18465
AND d.universal_time >= 3600
AND d.universal_time < 28803600
ORDER BY d.universal_time, mod_time DESC
Do you have any idea or tip why the sql statment for the first 8000 rows is faster than the stored procedure?
Many thanks in advance and
Best regards
George
Edited by: hakomdba on 09.01.2009 06:39Hallo DB-Experts,
I have encountered a performance problem regarding getting a DataReader by stored procedure versus a SQL statment
and I want to know if this is an known issue and how to tune it.
Getting a DataReader through a SQL statment is faster than with a stored procedure,
if the number of data rows are less than about 8000 datarows, although we are using an index.
The stored procedure ist only faster about 8000 datarows.
For the first 20 rows the different is between 50 abd 20 percent and between and 20 and 2000 rows it fall down to 10 percent.
Over 8000 rows the stored procedure is faster!
The time series table looks like:
CREATE TABLE TimeSeries
OBJECT_ID NUMBER(8) NOT NULL,
UNIVERSAL_TIME NUMBER(10) NOT NULL,
LOCAL_TIME DATE NOT NULL,
MOD_TIME NUMBER(10),
USERID NUMBER(10),
VALUE NUMBER NOT NULL,
FLAG NUMBER(2) DEFAULT 0 NOT NULL
The foreinkey is object_id and another index is for universal_time and mod_time
The stored procedure looks like:
PROCEDURE SELECTDATA_UT_MOD (pObjectID IN NUMBER,
pType IN VARCHAR2,
pTable IN VARCHAR2,
pFrom IN NUMBER,
pTo IN NUMBER,
IO_CURSOR OUT T_CURSOR)
IS
SQLString VARCHAR2(1024);
BEGIN
IF pOBJECTID <> 0 THEN
CASE
WHEN UPPER(pTYPE)='A' THEN
SQLString := 'SELECT UNIVERSAL_TIME, VALUE, FLAG, MOD_TIME FROM ' || pTABLE || ' WHERE OBJECT_ID = :t1 AND UNIVERSAL_TIME >= :t2 and UNIVERSAL_TIME < :t3 Order By UNIVERSAL_TIME, MOD_TIME DESC';
OPEN IO_CURSOR FOR
SQLString USING pOBJECTID,pFROM,pTO;
END IF;
END;
The SQL statment for the data reader looks like:
SELECT d.universal_time, d.VALUE, d.flag, 0 AS mod_time
FROM daten d
WHERE object_id = 18465
AND d.universal_time >= 3600
AND d.universal_time < 28803600
ORDER BY d.universal_time, mod_time DESC
Do you have any idea or tip why the sql statment for the first 8000 rows is faster than the stored procedure?
Many thanks in advance and
Best regards
George
Edited by: hakomdba on 09.01.2009 06:39 -
When I boot my computer I get error box stating "The procedure entry point _NSConcreteStackBlock could not be located in the dynamic link library CoreFoundation.dll. I have completely removed iTunes and related programs and reinstalled them several times. Doesn't fix the issue. Any ideas on how to fix this?
You should have one copy of CoreFoundation.dll in C:\Program Files\Common Files\Apple Application Support or C:\Program Files (x68)\Common Files\Apple Application Support if this is a 64-bit Windows.
The detailed file properties should be as shown.
If the file you have is correct check to see if there is another copy in the main iTunes folder. If so delete it and see if that helps.
Otherwise try uninstalling/deleting folders/reinstalling iTunes again. See Troubleshooting issues with iTunes for Windows updates for more details. Your issue looks a bit like it might be a variation of the issue in the first box.
Also worth checking that you have uninstalled the MobileMe control panel and any third party software that might try to talk to iTunes.
tt2 -
Hi,
I would like to get certified for the SAP Crystal Reports. So, I would like to get some info about the currently available Certification Exams for Crystal Reports (2011/2013). Also, would greatly appreciate if you have any suggestions for this Certification Exam preparation materials from another 3rd party or from SAP directly . I would like to prepare or get trained well before taking the exam as I see it costs around $500.
Thanks in advance for your help in this regard!
Sincerely,
JPlease search here.. Training and Certification Shop for your desired certification or training. Don't forget to set your location.
Please use some summarized title for your query.
Maybe you are looking for
-
Quicktime not playing correctly in html popup
Hi, I have been crazy trying to fix this problem and I didn't find the solution. I have just updated my system to Firefox 3.5.3 anq QuickTime 7.6.4 My site loads popups with quicktime .mov files inside. The problem is the funcionality of the quicktim
-
Aspect ratio bug with analog TVs?
I just bought an AppleTV, and connected it via component cables to a 4:3 TV (it's an older TV, has component inputs but only supports 480i, and it's 4:3, not widescreen). The problem is that all 4:3 content that I have is squished horizontally on the
-
I am using an iBook running OS 10.3.9 - and each time I have tried to launch the download so I can install it on my hard drive I get the message that the file is corrupt and so it won't complete the operation.
-
I have very simple code to get AD domain name Public Function GetDomainName() As String Dim sDomainName As String = String.Empty Try Dim currentUser As String = WindowsIdentity.GetCurrent().Name.Replace("\", "/") Dim strPath As String = String.Format
-
HT204074 i just got my iphone 5 i need to put my contacts and all on it. I just
I just bought an I phone 5 I chose new phone instead of back up iphone. so I need to get that going could you please help