KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Error while using Stored Procedure #2337

Open Mathieu Viennet opened this topic on on Sep 15, 2021 - 1 comments

Mathieu Viennet commented on Sep 15, 2021

Hi,

I need to know how to properly use a Store Procedure with KoolReports.

Right now, i'm calling the Store Proc in RawSQL :

    protected function dataSource()
    {

        return Incognito::rawSQL('        
		CALL rene_product_sales ("2020-01-01",  "2021-01-01", "blu%");
		');

    }

But i'm getting this error :

Message: Query Error >> [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'call rene_product_sales ("2020-01-01", "2021-01-01", "blu%"); ) as t' at line 2] >> SELECT COUNT(1) FROM ( call rene_product_sales ("2020-01-01", "2021-01-01", "blu%"); ) as t
Line: 433
File: /reports/koolreport/core/src/datasources/PdoDataSource.php

Thanks for helping!

Mathieu Viennet commented on Sep 15, 2021

Nevermind, i found the solution in the documentation

    protected function dataSource()
    {
        Return Incognito::procedure()->call("rene_product_sales", ["2020-01-01", "2021-01-01", "blu%"])->run(); 
    }

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

Dashboard