Procedure to increase return date

Asked

Viewed 55 times

0

I have the following table:

CREATE TABLE Emprestimo (
 id int PRIMARY KEY,
 dataRetirada date DEFAULT current_date,
 dataPrevistaDevolucao date DEFAULT current_date + 7,
 dataDevolucao date,
 codigoUsuario int,
 codigoExemplar int,
  FOREIGN KEY(CodigoUsuario) REFERENCES Usuario (CodigoUsuario),
  FOREIGN KEY(CodigoExemplar) REFERENCES Exemplares (CodigoExemplar)
);

And I need from this table to make a process that extends in 5 days the return period (without passing the maximum of days of the month) passing a pro ID Process, at first it would be good to use the Procedure to call a Function but I was passed very little on Process;

Note: I am developing inside Oracle SQL

What I got so far:

 CREATE OR REPLACE PROCEDURE P_Emprestimo (idE INT)IS BEGIN update Emprestimo set dataPrevistaDevolucao = dataPrevistaDevoluçao + 7 where id = idE; END;

And he returns to me:

Error(3,2): PL/SQL: SQL Statement Ignored Error(4,30): PL/SQL: ORA-00904: "DATAPREVISTADEVOLUÇAO": identifier invalid

  • The error is strange. It seems he can’t find the table column. Are you sure the table is created? It’s in the right schema?

  • Yes this created, but now it worked, I had to put the dataPrevistaDevolution everything in SET and only then the Procedure was compiled, I found it strange to compile only with the set in maisculo; CREATE OR REPLACE PROCEDURE P_emprestimo (Ide INT)IS BEGIN update Emprestimo set DATAPREVISTADEVOLUTICAO = DATAPREVISTADEVOLUCAO + 7 Where id = Ide; END; EXEC P_emprestimo (1); select * from emprestimo

1 answer

-1

What have I got so far:

CREATE OR REPLACE PROCEDURE P_Emprestimo (idE INT)IS
BEGIN
 update Emprestimo
 set dataPrevistaDevolucao = dataPrevistaDevoluçao + 7
 where id = idE;
END;

When he returns to me:

Erro(3,2): PL/SQL: SQL Statement ignored
Erro(4,30): PL/SQL: ORA-00904: "DATAPREVISTADEVOLUÇAO": identificador inválido

Browser other questions tagged

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