can someone find the error please
-
DECLARE
cursor c1 is select * from dept;
cursor c2 is select * from emp;
s emp.sal % type;
BEGIN
for i in c1
s:=0;
dbms_output.put_line(‘-----------------------------------------------------’);
dbms_output.put_line(‘Department is:’║ i.deptno║’Department name is:’║i.dname);
dbms_output.put_line(‘---------------------------------------------------------’);
for j in c2
if(i.deptno=j.deptno)then
s:=s+j.sal;
dbms_output.put_line(j.empno║ ‘ ‘║j.ename ║’ ‘║j.sal);
end if;
end loop;
dbms_output.put_line(‘--------------------------------------------------------’);
dbms_output.put_line (‘Total salary is:’║s);
dbms_output.put_line(‘--------------------------------------------------------’);
end loop;
END;Please help i need solution ASAP ty
-
DECLARE
cursor c1 is select * from dept;
cursor c2 is select * from emp;
s emp.sal % type;
BEGIN
for i in c1
s:=0;
dbms_output.put_line(‘-----------------------------------------------------’);
dbms_output.put_line(‘Department is:’║ i.deptno║’Department name is:’║i.dname);
dbms_output.put_line(‘---------------------------------------------------------’);
for j in c2
if(i.deptno=j.deptno)then
s:=s+j.sal;
dbms_output.put_line(j.empno║ ‘ ‘║j.ename ║’ ‘║j.sal);
end if;
end loop;
dbms_output.put_line(‘--------------------------------------------------------’);
dbms_output.put_line (‘Total salary is:’║s);
dbms_output.put_line(‘--------------------------------------------------------’);
end loop;
END;Please help i need solution ASAP ty
Well, what's the problem? :confused:
-
Well, what's the problem? :confused:
This is the error :(
ERROR at line 7:
ORA-06550: line 7, column 7:
PLS-00103: Encountered the symbol "S" when expecting one of the following:
. ( * @ % & - + / at loop mod remainder rem ..
<an exponent (**)> || multiset
The symbol "loop" was substituted for "S" to continue.
ORA-06550: line 8, column 27:
PLS-00103: Encountered the symbol "`" when expecting one of the following:
( ) - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max min pr
ORA-06550: line 9, column 24:
PLS-00103: Encountered the symbol "`" when expecting one of the following:
( ) - + case mod new not null select <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max -
This is the error :(
ERROR at line 7:
ORA-06550: line 7, column 7:
PLS-00103: Encountered the symbol "S" when expecting one of the following:
. ( * @ % & - + / at loop mod remainder rem ..
<an exponent (**)> || multiset
The symbol "loop" was substituted for "S" to continue.
ORA-06550: line 8, column 27:
PLS-00103: Encountered the symbol "`" when expecting one of the following:
( ) - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max min pr
ORA-06550: line 9, column 24:
PLS-00103: Encountered the symbol "`" when expecting one of the following:
( ) - + case mod new not null select <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists maxI have no idea what language that is, but perhaps you shouldn't be using the ` character. As for S on line 7, you're on your own.
-
DECLARE
cursor c1 is select * from dept;
cursor c2 is select * from emp;
s emp.sal % type;
BEGIN
for i in c1
s:=0;
dbms_output.put_line(‘-----------------------------------------------------’);
dbms_output.put_line(‘Department is:’║ i.deptno║’Department name is:’║i.dname);
dbms_output.put_line(‘---------------------------------------------------------’);
for j in c2
if(i.deptno=j.deptno)then
s:=s+j.sal;
dbms_output.put_line(j.empno║ ‘ ‘║j.ename ║’ ‘║j.sal);
end if;
end loop;
dbms_output.put_line(‘--------------------------------------------------------’);
dbms_output.put_line (‘Total salary is:’║s);
dbms_output.put_line(‘--------------------------------------------------------’);
end loop;
END;Please help i need solution ASAP ty
It looks like you're missing the keyword
loop
afterfor i in c1
and afterfor j in c2
Try this:DECLARE
cursor c1 is select * from dept;
cursor c2 is select * from emp;
s emp.sal % type;
BEGIN
for i in c1
loop
s:=0;
dbms_output.put_line(‘-----------------------------------------------------’);
dbms_output.put_line(‘Department is:’║ i.deptno║’Department name is:’║i.dname);
dbms_output.put_line(‘---------------------------------------------------------’);
for j in c2
loop
if(i.deptno=j.deptno)then
s:=s+j.sal;
dbms_output.put_line(j.empno║ ‘ ‘║j.ename ║’ ‘║j.sal);
end if;
end loop;
dbms_output.put_line(‘--------------------------------------------------------’);
dbms_output.put_line (‘Total salary is:’║s);
dbms_output.put_line(‘--------------------------------------------------------’);
end loop;
END;
/Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
-
I have no idea what language that is, but perhaps you shouldn't be using the ` character. As for S on line 7, you're on your own.
It looks like PL-SQL to me.
Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
-
It looks like PL-SQL to me.
Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
Yes, but embedded in something Pascal-like? I haven't done PRO*C for more than ten years.
-
Yes, but embedded in something Pascal-like? I haven't done PRO*C for more than ten years.
Well, that's PL/SQL, it's meant to look like ADA or Pascal. PL/SQL != Pro*C
Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
-
Well, that's PL/SQL, it's meant to look like ADA or Pascal. PL/SQL != Pro*C
Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
Not when I did it.