I am trying to perform this but getting error.
create or replace procedure sync_multiple_new as
poi_userid number(10);
phone varchar2(1000);
source_cpcid number(10);
rec_id number(10);
CURSOR abc IS select subject_id,
SUBJECT_NAME,
SUBJECT_IMAGE,
SUBJECT_ADDRESS,
SUBJECT_PERSONALEMAIL,
SUBJECT_PERSONALPHONENUMBER,
subject_gender,
ID,
USERNAME,
PASS,
USER_ID,
LAST_LOGIN,
TYPE,
SOURCE_TYPE,
STATUS,
DSTATUS,
PHMODEL,
DEVICESNO,
PHONENO from users;
begin
for rec in abc
loop
if rec.subject_id is null then
insert into user(NAME,GENDER,IMAGE) values (rec.subject_name,rec.subject_gender,rec.subject_image);
elseif (rec.id is null) Then
insert into user(NAME,GENDER,IMAGE,source) values (rec.subject_name,rec.subject_gender,rec.subject_image);
end if;
end loop;
end;
Error: PLS-00103: Encountered the symbol "THEN" when expecting one of the following: := . ( % ;
Error: PLS-00103: Encountered the symbol "IF" when expecting one of the following: ; <an identifier> <a double-quoted delimited-identifier> current delete exists prior <a single-quoted SQL string>
Change ELSEIF to ELSIF
SQL> declare
2
3 CURSOR abc IS select * from all_Objects;
4 begin
5 for rec in abc
6 loop
7 if rec.object_id is null then
8 null;
9 elseif rec.owner is null then
10 null;
11 end if;
12
13 end loop;
14 end;
15 /
elseif rec.owner is null then
*
ERROR at line 9:
ORA-06550: line 9, column 10:
PLS-00103: Encountered the symbol "REC" when expecting one of the following:
:= . ( @ % ;
The symbol ":=" was substituted for "REC" to continue.
ORA-06550: line 9, column 28:
PLS-00103: Encountered the symbol "THEN" when expecting one of the following:
; and or
The symbol "; was inserted before "THEN" to continue.
SQL>
SQL>
SQL>
SQL>
SQL> declare
2
3 CURSOR abc IS select * from all_Objects;
4 begin
5 for rec in abc
6 loop
7 if rec.object_id is null then
8 null;
9 elsif rec.owner is null then
10 null;
11 end if;
12
13 end loop;
14 end;
15 /
PL/SQL procedure successfully completed.