I wish to create a stored procedure that performs a select insert , but uses the parameter as the value for one of the columns. This is one thing I've tried:
create or replace PROCEDURE "CRT_FUEL_QRTRLY_ADTV_RCRDS" (fuel_id_new varchar2)
IS
FUEL_ADDITIVE_record_count number;
BEGIN
select count(1) into FUEL_ADDITIVE_record_count
from FUEL_ADDITIVE
where FUEL_ID = fuel_id_new;
if FUEL_ADDITIVE_record_count = 0
then
insert into FUEL_QUARTERLY_ADDITIVE
(FUEL_ID, ADDITIVE_ID, YEAR, QUARTER)
values(
(select FUEL_ID, ADDITIVE_ID, YEAR, QUARTER
from FUEL_ADDITIVE
where FUEL_ID = fuel_id_new));
end if;
END;
but when I compile it, I get the error "ORA-00947; not enough values."
What is the simplest way of doing this?