Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. can someone find the error please

can someone find the error please

Scheduled Pinned Locked Moved Database
helpcareer
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 8287581
    wrote on last edited by
    #1

    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

    P J 2 Replies Last reply
    0
    • U User 8287581

      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

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Well, what's the problem? :confused:

      U 1 Reply Last reply
      0
      • P PIEBALDconsult

        Well, what's the problem? :confused:

        U Offline
        U Offline
        User 8287581
        wrote on last edited by
        #3

        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

        P 1 Reply Last reply
        0
        • U User 8287581

          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

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          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.

          J 1 Reply Last reply
          0
          • P PIEBALDconsult

            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.

            J Offline
            J Offline
            Jorgen Andersson
            wrote on last edited by
            #5

            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

            P 1 Reply Last reply
            0
            • U User 8287581

              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

              J Offline
              J Offline
              Jorgen Andersson
              wrote on last edited by
              #6

              It looks like you're missing the keyword loop after for i in c1 and after for 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

              1 Reply Last reply
              0
              • J Jorgen Andersson

                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

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                Yes, but embedded in something Pascal-like? I haven't done PRO*C for more than ten years.

                J 1 Reply Last reply
                0
                • P PIEBALDconsult

                  Yes, but embedded in something Pascal-like? I haven't done PRO*C for more than ten years.

                  J Offline
                  J Offline
                  Jorgen Andersson
                  wrote on last edited by
                  #8

                  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

                  P 1 Reply Last reply
                  0
                  • J Jorgen Andersson

                    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

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #9

                    Not when I did it.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups