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;
There are several issues with your procedure:
IS/AS
and BEGIN
keywords. Not that you need to in this case. That means you could rewrite your procedure to be:
CREATE OR REPLACE PROCEDURE api_submission(rid_tx IN VARCHAR2,
rform_name IN VARCHAR2,
rdata_date IN VARCHAR2,
v_submission_id OUT NUMBER) IS
BEGIN
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(reia_id_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;
/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.