We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

execute a stored procedure

HELLO, I HAVE A STORED PROCEDURE IN MY DATABASE CAN I run it from Phalcon


    $insert="BEGIN  PCS_INSERTAR_PRODUCTO("
    ."'$CODIGO' "
    .",'$DESCRIPCION'"
    .",'$TIPODO' "
    .",'' "
    .",'$OBSERVACION'"
    ." ,'$CODIG1'"
    .",'$CODIG2'"
    .",'$TIPOXX' "
    .",'$TIPO' "
    .",'$RCODIGO'"
    ." ,'$RECURSIVA'"
    .",'$FECHAI' "
    .",'$USUARIO'"
        .",'GUARDAR','$ESTADO');"
        ."END;";


81.2k

hello is a function in the database you want to run from Phalcon



43.9k

Hi,

I'm not really used with that. But I think that if you want to execute a database procedure (a procedure that is defined in the database itself), you will have to do that with raw SQL.



81.2k
Accepted
answer
edited Oct '16
$model = new OneOfYourModels();
$model->getReadConnection()->query(
"CALL nameOfYourProcedure()"
);