Support the ongoing development of Laravel.io →
posted 9 years ago
Database
Last updated 1 year ago.
0

I tend to just do it as you would in native PHP: http://stackoverflow.com/questions/22517903/using-a-stored-pro...

On some projects I have abstracted it into it's own class to make it more concise (automatically sets the database to use, gives a better way to access the return value).

I would certainly advise putting your stored procedures in a repository, it makes it easier to manage in the long term. https://laracasts.com/search?q=repository

Last updated 1 year ago.
0

I have a proble related to this issue

If I do:

$st = \DB::select( "DECLARE @liResult INT, @lsMsg VARCHAR(200); EXEC ONW_SP_CANCELA_EMP '000016', @liResult, @lsMsg OUTPUT; SELECT @liResult as result, @lsMsg as msg;" );

dd($st);

I get:

[]

But if I do this (comment out the exec to SP):

$st = \DB::select( "DECLARE @liResult INT, @lsMsg VARCHAR(200); -- EXEC ONW_SP_CANCELA_EMP '000016', @liResult, @lsMsg OUTPUT; SELECT @liResult as result, @lsMsg as msg;" );

dd($st);

I get this:

array:1 [▼ 0 => {#333 ▼ +"result": null +"msg": null } ]

An if I execute in the rdms console I do get the select correctly, do you know a work around for this?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

erhansogut erhansogut Joined 18 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.