This is my first time creating a stored proc that has both IN and OUT parameters, and i am pretty lost. What i am trying to do is have an API pass in 3 parameters (ID_TX, FORM_NAME and DATA_DATE) into my stored proc and have my stored procedure do a simple insert and then pass out a single value (SUBMISSION_ID). However, when I try to compile the code, i keep getting the errors. The errors are as follows:
Error(8,1): PLS-00103: Encountered the symbol "INSERT" when expecting one of the following: begin function pragma procedure subtype type <an identifier> <a double-quoted delimited-identifier> current cursor delete exists prior The symbol "begin" was substituted for "INSERT" to continue.
Error(10,1): PLS-00103: Encountered the symbol "RETURNING" when expecting one of the following: . ( ) , * % & = - + < / > at in is mod remainder not rem => <an exponent (**)> <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset member submultiset
Error(11,1): PLS-00103: Encountered the symbol "END"
Is there some syntax basics/knowledge that I am missing? Thanks in advance!
create or replace procedure API_SUBMISSION(rID_TX IN VARCHAR, rFORM_NAME IN VARCHAR, rDATA_DATE IN VARCHAR, v_submission_id OUT NUMBER)
IS BEGIN
DECLARE
v_submission_id number;
insert into submission (SUBMISSION_ID, RESPONDENT_ID, SUBMISSION_DT, SUBMISSION_TYPE_ID, SUBMISSION_NAME_TX, SUBMISSION_SEQ_NB, CREATE_DT, CREATE_USER_ID, MODIFY_DT, MODIFY_USER_ID, EFFECTIVE_DT, INACTIVE_DT)
VALUES (null, get__respondent_id(rID_TX, rFORM_NAME, trunc(sysdate), sysdate, rDATA_DATE || 'TEST ' || rFORM_NAME, 1, sysdate, 1, null, null, null, null)
returning submission_id into v_submission_id;
END API_SUBMISSION;