0

I am running this procedure to calculate total price based on days inserted.

CREATE OR REPLACE PROCEDURE calcTotal
(p_checkInDate IN STAYRECORD.checkInDate%TYPE,
p_checkOutDate IN STAYRECORD.checkOutDate%TYPE,
p_cageNo IN STAYRECORD.cageNo%TYPE,
p_total OUT number)

AS
p_price float;

BEGIN
select price into p_price 
from cage 
where cageNo = p_cageNo;

p_total := 'select (to_date(p_checkOutDate, 'dd/mm/yyyy')-to_date(p_checkInDate, 'dd/mm/yyyy')) * p_price'|| 
      'from dual';

END;
/

whenever i put 'dd-mm-yyyy' the procedure is created with compilcation errors saying that

'encountered the symbol "DD"'.

why is that so?

Jaydip Jadhav
  • 12,179
  • 6
  • 24
  • 40

0 Answers0