SQL Syntax Error Exception: ORA-00928: SELECT keyword not found

1

I'm getting this message when trying to run a Stored Procedure created in Oracle:

  

java.sql.SQLSyntaxErrorException: ORA-00928: SELECT keyword does not   found

     

at oracle.jdbc.driver.T4CTTIoer.processError (T4CTTIoer.java:447) at   oracle.jdbc.driver.T4CTTIoer.processError (T4CTTIoer.java:396) at   oracle.jdbc.driver.T4C8Oall.processError (T4C8Oall.java:951) at   oracle.jdbc.driver.T4CTTIfun.receive (T4CTTIfun.java:513) at   oracle.jdbc.driver.T4CTTIfun.doRPC (T4CTTIfun.java:227) at   oracle.jdbc.driver.T4C8Oall.doOALL (T4C8Oall.java:531) at   oracle.jdbc.driver.T4CCallableStatement.doOall8 (T4CCallableStatement.java:205)   at   oracle.jdbc.driver.T4CCallableStatement.executeForRows (T4CCallableStatement.java:1043)   at   oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout (OracleStatement.java:1336)   at   oracle.jdbc.driver.OraclePreparedStatement.executeInternal (OraclePreparedStatement.java:3613)   at   oracle.jdbc.driver.OraclePreparedStatement.execute (OraclePreparedStatement.java:3714)   at   oracle.jdbc.driver.OracleCallableStatement.execute (OracleCallableStatement.java:4755)   at   oracle.jdbc.driver.OraclePreparedStatementWrapper.execute (OraclePreparedStatementWrapper.java:1378)   at drive3.AppClient.insertSP (ClientApp.java:71) at   unit3.UserApp.main (ClientApp.java:192)

create or replace PROCEDURE SP_INSERIRCLIENTE 
(
  CPF IN INTEGER 
, NOME IN VARCHAR2 
, EMAIL IN VARCHAR2 
) AS 
BEGIN
  INSERT INTO CLIENTE VALUES(CPF, NOME, EMAIL);
END SP_INSERIRCLIENTE;
    
asked by anonymous 17.09.2018 / 12:33

2 answers

0

I believe your problem is in the procedure creation syntax. Take a look on this link talking about different ways to use a proc and tries to create it like this:

create procedure SP_INSERIRCLIENTE 
@CPF integer,
@NOME varchar(255),
EMAIL varchar(255)
begin
   INSERT INTO CLIENTE (CPF, NOME, EMAIL)
   VALUES(@CPF, @NOME, @EMAIL);
end;

By analyzing the answer better, I realized that this is a procedure in oracle , so I researched the suggested structure in devmedia and I set it up as follows:

create or replace procedure SP_INSERIRCLIENTE 
(CPF_PARAM IN INTEGER, NOME_PARAM IN VARCHAR2, EMAIL_PARAM IN VARCHAR2)
begin
   INSERT INTO CLIENTE (CPF, NOME, EMAIL)
   VALUES(CPF_PARAM, NOME_PARAM, EMAIL_PARAM);
end

I basically removed the as that existed in the original proc statement and named the fields in the cliente table in insert

NOTE: always try to add as many useful information as possible to the question (of course, without letting the question turn into a book = p) and add the tags to the question. >     

17.09.2018 / 12:47
0

I think in your case the solution is simple:

CREATE OR REPLACE PROCEDURE SP_INSERIRCLIENTE 
(
        CPF     IN INTEGER
    ,   NOME    IN VARCHAR2
    ,   EMAIL   IN VARCHAR2 
) IS 
BEGIN
    INSERT INTO CLIENTE VALUES(CPF, NOME, EMAIL);
END;
/
    
18.09.2018 / 13:26