Home » SQL & PL/SQL » SQL & PL/SQL » ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo (oracle11g)
ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632864] Fri, 06 February 2015 06:14 Go to next message
orcle_us
Messages: 21
Registered: February 2015
Junior Member
Hi

I am working on a project and I encountered this error ORA-06550: line 15, column 5:
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>


my code is

declare
cursor c is select * from short_input;
v_count number(2,2);
v_blood char(2) := 'B';
begin
for r in c
v_count:=1;
loop
if (r.no_of_blood_samples)>=1
then
dbms_output.put_line(r.sn||r.patient_id||' '||v_blood.v_count);
else c%notfound
then
raise no_data_found;
end if;
v_count:=v_count+1;
close c;
end loop;
end;



i have also tried by not specifying c%notfound

declare
cursor c is select * from short_input;
v_count number(2,2);
v_blood char(2) := 'B';
begin
for r in c
v_count:=1;
loop
if (r.no_of_blood_samples)>=1
then
dbms_output.put_line(r.sn||r.patient_id||' '||v_blood.v_count);
end if;
v_count:=v_count+1;
close c;
end loop;
end;



ORA-06550: line 16, column 4:
PLS-00103: Encountered the symbol ";" when expecting one of the following:

   loop
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.



Can anyone help please?

Many thanks


Lalit : Added code tags, however the formatting is still missing. Please do so yourself in future, read How to use [code] tags

[Updated on: Fri, 06 February 2015 06:23] by Moderator

Report message to a moderator

Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632865 is a reply to message #632864] Fri, 06 February 2015 06:17 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
V_COUNT := 1 is misplaced; should be in front of the loop.
"ELSE C%NOTFOUND" should be, probably, "ELSIF C%NOTFOUND"
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632866 is a reply to message #632865] Fri, 06 February 2015 06:27 Go to previous messageGo to next message
orcle_us
Messages: 21
Registered: February 2015
Junior Member
Thank you it worked. But still encountering different problem

here is the code

declare
cursor c is select * from short_input;
v_count number(2,2) :=1;
v_blood char(2) := 'B';
begin
--v_count:=1;
for r in c
loop
if (r.no_of_blood_sample_tubes)>=1
then
dbms_output.put_line(r.sn||r.patient_id||' '||v_blood.v_count);
end if;
v_count:=v_count+1;
close c;
end loop;
end;


error is

ORA-06550: line 11, column 55:
PLS-00487: Invalid reference to variable 'V_BLOOD'
ORA-06550: line 11, column 1:
PL/SQL: Statement ignored


many thanks


Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632867 is a reply to message #632866] Fri, 06 February 2015 06:32 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What is V_BLOOD.V_COUNT supposed to be? These are two different variables, you'll have to concatenate them.
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632868 is a reply to message #632867] Fri, 06 February 2015 06:45 Go to previous messageGo to next message
orcle_us
Messages: 21
Registered: February 2015
Junior Member
Oh got it. Thank you for your time
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632870 is a reply to message #632867] Fri, 06 February 2015 07:13 Go to previous messageGo to next message
orcle_us
Messages: 21
Registered: February 2015
Junior Member
hi

when concatenating a string and a number, i am getting error

ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at line 7
06502. 00000 - "PL/SQL: numeric or value error%s"
*Cause: An arithmetic, numeric, string, conversion, or constraint error
occurred. For example, this error occurs if an attempt is made to
assign the value NULL to a variable declared NOT NULL, or if an
attempt is made to assign an integer larger than 99 to a variable
declared NUMBER(2).
*Action: Change the data, how it is manipulated, or how it is declared so
that values do not violate constraints.


my code is

declare
cursor c is select * from short_input;
v_count number(2,2);
v_blood char(2);
v_concat varchar2(10);
begin
v_count:=1;
v_blood:='B';
--v_concat:=v_blood||v_count;
for r in c
loop
if (r.no_of_blood_sample_tubes)>=1
then
dbms_output.put_line(r.sn||r.patient_id||' '||concat(v_blood,v_count));
end if;
v_count:=v_count+1;
close c;
end loop;
end;
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632872 is a reply to message #632870] Fri, 06 February 2015 07:27 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
So, what did you do after reading the cause and the action? I hope you did read it, not just copy/pasted it over here.

By the way, as it seems that you didn't read it yet, spend 10 seconds of your time and read how to use [code] tags which will improve readability of your future messages.
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632873 is a reply to message #632870] Fri, 06 February 2015 07:28 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Would you please spend a minute to read the link I provided in the first post? And unformatted code is really difficult to be interpreted and to debug.
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632876 is a reply to message #632873] Fri, 06 February 2015 09:14 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>v_count number(2,2);

What is the largest value that V_COUNT is allowed to contain?
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632877 is a reply to message #632876] Fri, 06 February 2015 09:36 Go to previous messageGo to next message
orcle_us
Messages: 21
Registered: February 2015
Junior Member
V_count largest value allowed is 5

[Updated on: Fri, 06 February 2015 09:39]

Report message to a moderator

Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632878 is a reply to message #632877] Fri, 06 February 2015 09:40 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
orcle_us wrote on Fri, 06 February 2015 07:36
V_count largest value allowed is 5


I don't believe you.

07:39:25 SQL> @test
07:39:30 SQL> DECLARE
07:39:30   2  
07:39:30   3  v_count number(2,2);
07:39:30   4  BEGIN
07:39:30   5  V_COUNT := 5;
07:39:30   6  V_COUNT := 10;
07:39:30   7  V_COUNT := 100;
07:39:30   8  end;
07:39:30   9  /
DECLARE
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at line 5


Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632898 is a reply to message #632878] Fri, 06 February 2015 14:10 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632923 is a reply to message #632898] Sat, 07 February 2015 02:48 Go to previous messageGo to next message
orcle_us
Messages: 21
Registered: February 2015
Junior Member
yeah, thank you. I am learning oracle and new to this forum. Thanks for letting me know.
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632928 is a reply to message #632923] Sat, 07 February 2015 07:43 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member

Post Guidelines include #12 If you found an answer yourself, post it. That way we know the issue is resolved and we might learn from it.
Re: ORA-06550: line 15, column 5: PLS-00103: Encountered the symbol "IF" when expecting one of the follo [message #632933 is a reply to message #632928] Sat, 07 February 2015 13:29 Go to previous message
orcle_us
Messages: 21
Registered: February 2015
Junior Member
I solved it by increasing the v_count datatype
Previous Topic: Getting boundaries
Next Topic: Sql query to read the hardcoded values
Goto Forum:
  


Current Time: Wed Apr 24 14:17:19 CDT 2024