0
I cannot run a precedent by PHP, at the time of sending the PDO execute displays the image error, in my base oracle the Procedure runs normally.
I tried to make it display the SQL error but failed
Follows excerpt from my code:
if ($pdo = conectar()) {
$last_nunota = $pdo->prepare("SELECT NUNOTA FROM TGFCAB WHERE
NUNOTA = (SELECT MAX(NUNOTA) FROM TGFCAB)"); //definindo nº unico TGFCAB
$last_nunota->execute();
$array_nunota = $last_nunota->fetch(PDO::FETCH_ASSOC);
$nunota = $array_nunota['NUNOTA'];
$nunota++;
$next_nunota = $nunota;
$last_numreq = $pdo->prepare("SELECT DISTINCT AD_NUMREQ FROM TGFCAB WHERE
AD_NUMREQ = (SELECT MAX(AD_NUMREQ) FROM TGFCAB)"); //número requisição
$last_numreq->execute();
$array_numreq = $last_numreq->fetch(PDO::FETCH_ASSOC);
$numreq = $array_numreq['AD_NUMREQ'];
$numreq++;
$next_numreq = $numreq;
$insert_cab = $pdo->prepare("EXECUTE STP_INSERE_REQUISICOES(?,?,?,?,?,?,?)"); //insert na cab
$insert_cab->bindValue(1, $next_nunota, PDO::PARAM_INT);
$insert_cab->bindValue(2, $next_numreq, PDO::PARAM_INT);
$insert_cab->bindValue(3, $obs, PDO::PARAM_STR);
$insert_cab->bindValue(4, $codcencus, PDO::PARAM_INT);
$insert_cab->bindValue(5, $codnat, PDO::PARAM_INT);
$insert_cab->bindValue(6, $codtop, PDO::PARAM_INT);
$insert_cab->bindValue(7, $codparc, PDO::PARAM_INT);
$insert_cab->execute();
--below follows my Precedent:
CREATE OR REPLACE PROCEDURE TESTE.STP_INSERE_REQUISICOES(
P_NUNOTA NUMBER,
P_NUMREQ NUMBER,
P_OBS VARCHAR,
P_CODCENCUS NUMBER,
P_CODNAT NUMBER,
P_CODTOP NUMBER,
P_CODPARC NUMBER)
AS
V_DHTIPOPER DATE;
V_TIPMOV VARCHAR2(1) :='J';
/****************************************************************
* Objetivo: Inserir requisições de PRODUTOS OU SERVIÇOS *
* para o portal de requisições instalado na Intranet. *
* Autor: Jeiel Rodrigues Silva *
* Data: 01/03/2019 *
****************************************************************/
BEGIN
-- Pegando informações atualizadas da TOP
SELECT
TOP.DHALTER,
TOP.TIPMOV
INTO
V_DHTIPOPER,
V_TIPMOV
FROM TGFTOP TOP
WHERE TOP.CODTIPOPER = P_CODTOP
AND TOP.DHALTER = ( SELECT MAX( TP.DHALTER )
FROM TGFTOP TP
WHERE TP.CODTIPOPER = P_CODTOP);
INSERT INTO TGFCAB(
AD_NUMREQ,
NUNOTA,
AD_OBSERVACAOINTERNA,
AD_RCLIBERADA,
AD_RCVERIF,
AD_CONFORME,
CODEMP,
CODCENCUS,
NUMNOTA,
DTNEG,
CODEMPNEGOC,
SERIENOTA,
CODPARC,
CODTIPOPER,
DHTIPOPER,
TIPMOV,
CODTIPVENDA,
DHTIPVENDA,
CODVEND,
CODPARCREDESPACHO,
COMISSAO,
CODMOEDA,
CODOBSPADRAO,
VLRSEG,
VLRICMSSEG,
VLRDESTAQUE,
VLRJURO,
VLRVENDOR,
VLROUTROS,
VLREMB,
VLRICMSEMB,
VLRDESCSERV,
IPIEMB,
TIPIPIEMB,
VLRDESCTOT,
VLRDESCTOTITEM,
VLRFRETE,
ICMSFRETE,
BASEICMSFRETE,
TIPFRETE,
VLRNOTA,
CODPARCTRANSP,
QTDVOL,
PENDENTE,
BASEICMS,
VLRICMS,
BASEIPI,
VLRIPI,
ISSRETIDO,
BASEISS,
VLRISS,
APROVADO,
STATUSNOTA,
IRFRETIDO,
VLRIRF,
DTALTER,
CODPARCDEST,
VLRSUBST,
BASESUBSTIT,
CODPROJ,
NUMCONTRATO,
BASEINSS,
VLRINSS,
VLRREPREDTOT,
PERCDESC,
CODPARCREMETENTE,
CODPARCCONSIGNATARIO,
CODNAT,
TROCO,
CODUSUCOMPRADOR,
CIF_FOB,
CODCONTATO,
CODUSU,
CODUSUINC)
VALUES (
P_NUMREQ, --AD_NUMREQ
P_NUNOTA, --NUNOTA
P_OBS, --OBSERVAÇÃO INTERNA
'N', --AD_RCLIBERADA
'N', --AD_RCVERIF
'N', --AD_CONFORME
1, --CODEMP
P_CODCENCUS, --CODCENCUS
0,--V_NUMNOTA, --NUMNOTA
sysdate, --DTNEG
1, --CODEMPNEGOC
1, --SERIENOTA
P_CODPARC, --CODPARC
P_CODTOP, --CODTIPOPER
V_DHTIPOPER, --DHTIPOPER
V_TIPMOV, --TIPMOV
0, --CODTIPVENDA
'01/01/1998', --DHTIPVENDA
0, --CODVEND
0, --CODPARCREDESPACHO
0, --COMISSAO
0, --CODMOEDA
0, --CODOBSPADRAO
0, --VLRSEG
0, --VLRICMSSEG
0, --VLRDESTAQUE
0, --VLRJURO
0, --VLRVENDOR
0, --VLROUTROS
0, --VLREMB
0, --VLRICMSEMB
0, --VLRDESCSERV
0, --IPIEMB
'N', --TIPIPIEMB
0, --VLRDESCTOT
0, --VLRDESCTOTITEM
0, --VLRFRETE
0, --ICMSFRETE
0, --BASEICMSFRETE
'S', --TIPFRETE
0, --VLRNOTA
0, --CODPARCTRANSP
0, --QTDVOL
'S', --PENDENTE
0,
0,
0,
0,
'N',
0,
0,
'N',
'L',
'S',
0,
SYSDATE,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
P_CODNAT, --CODNAT
0,
0,
'S', /*CIF_FOB SEM FRETE*/
null,
0,
0
);
END;
Hello Jeiel, welcome! After connection
new PDO()
insert$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
and after the[..]$pdo->prepare[..]
insertprint_r($insert_cab ->errorInfo());
which will show the error– Andrei Coelho
Solved Andrei, thank you very much!
– Jeiel Rodrigues
Oops! No problem!
– Andrei Coelho