Error while creating a PROCEDURE

Asked

Viewed 75 times

0

I’m creating a database to insert data into a table in the database, but this gives an error that I can’t identify:

Commando:

begin
   INCLUIR_CLIENTE(1, 'SUPERMERCADO XYZ', '12345', NULL, 150000);
end;

Message presented:

ORA-06550: line 2, column 1: PLS-00905: Object PLSQL_SCHEMA_CARLOS.INCLUIR_CLIENTE is invalid ORA-06550: line 2, column 1: PL/SQL: Statement Ignored

Structure of the Client Table: Table Client

Procedure I am creating:

create or replace PROCEDURE INCLUIR_CLIENTE 
   (p_id in cliente.id%type,
    p_razao_social IN cliente.razao_social%type,
    p_cnpj cliente.cnpj%type ,
    p_segmercado_id IN cliente.segmercado_id%type,
    p_faturamento_previsto IN cliente.faturamento_previsto%type)
IS
    v_categoria cliente.categoria%type;
BEGIN
    IF p_faturamento_previsto < 10000 THEN
            v_categoria := 'PEQUENO';
        ELSIF p_faturamento_previsto < 50000 THEN
            v_categoria := 'MEDIO';
        ELSIF p_faturamento_previsto < 100000 THEN 
            v_categoria := 'MEDIO GRANDE';
        ELSE
            v_categoria := 'GRANDE';
    END IF;  
    INSERT INTO cliente VALUES (p_id, UPPER(p_razao_social), p_cnpj,p_segmercado_id, SYSDATE, p_faturamente_previsao, v_categoria);
    COMMIT;
END;

The table fields are all hitting, but even so is giving this error. Can anyone help me, use the Oracle Apex platform ?

  • I closed the previous question

  • Compilation failed,line 21 (17:15:53) PL/SQL: ORA-00984: column not allowed hereCompilation failed,line 21 (17:15:53) PL/SQL: SQL Statement Ignored

  • Can put in question the client table structure?

  • I put the link to the description of the question

1 answer

0

At least in the Oracle Apex environment you should include the Insert columns, as in this example:

INSERT INTO cliente (RAZAO_SOCIAL,  CNPJ,SEGMERCADO,FATURAMENTO_PREVISTO,CATEGORIA) VALUES
(UPPER(p_razao_social), p_cnpj,p_segmercado, p_faturamento_previsto,
v_categoria); 

Note that I did not include the id, because when creating the table I did with auto-increment, but this is from each solution.
The p_waybill item is misspelled on your Insert; p_invoice_preview

Check the inclusion order of the Procedure call, as I do not know how you declared the types in the tables, it may be that the order is changed.
This happened to me until I corrected in the correct sequence. This was not a mistake, as it is a non-compulsory directive, but did not put the clause in, or in out for the CNPJ. The call went like this:

begin    
     INCLUIR_CLIENTE(1, 'SUPERMERCADO ABC', 123645,  'A', 150000 ); 
end;

The first argument from Procedure for me doesn’t fit, the id, was just to keep the same model you used.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.