cancel
Showing results for 
Search instead for 
Did you mean: 

mysql stored procedure , crystalreport error

0 Kudos

I have a question related to mysql and crystalreport.

There is a MySQL stored procedure created in MySQL dB that have 2 IN parameters as varchar(20) for startdate and enddate(in procedure, it is converted to date type value with str_to_date).

In Crystal Report it is the report with two parameters as string type startdate and enddate
When I use this procedure from command of the report as:
call MyProcedure('{?startdate}','{?enddate}');
it returns error :

"Failed to retrieve data from the database.
Details :HY000:[MySQL][ODBC 5.1
Driver][mysqld-5.7.33-0ubuntu0.16.04.1-log]Incorrect datetime value:''
for function str_to_date [Database Vendor Code 1411]
"

if I use fixed values, no parameter values, as :
call MyProcedure('01/01/2022','05/01/2022');
it works and returns values in report.

When parameters are prompted to be sent they are written as in fixed version.
Has crystal report some problems with mysql stored procedures to call it?
What is the solution to such issue?

DellSC
Active Contributor
0 Kudos

I changed your tag to "SAP Crystal Reports", which is the tag that covers database connectivity and report design. The "SAP Crystal Report, version for Visual Studio" tag is for questions about using the .NET SDK in code.

-Dell

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Create a new report and select the SP, fil in the dates and then look in the Show SQL, it may show you the format CR is passing.

Then look in the Command window by Show Command in the Connection properties, you should see the 2 parameters listed. Likely cause is the ? in the parameter of the Command.

0 Kudos

Problem was that report was modified, first time it refer to MSSQL dB then to a MySQL dB and first command was deleted and then added second command in which call to procedure was made , it seems that such modifications made some internal problems.

When a new report was made, from the start connected to MySQL dB, and was added a command with call to MySQL procedure it worked.

Answers (0)