Skip to content
Advertisement

i am trying to combine the PL/SQL and the SQL commands in manipulating the database. am i doing it correctly? any help and corrections?

enter image description hereuse PL/SQL with SQL commands in manipulating the database (PL/SQL structure, Data types, Variable, DBMS Output and Conditions) and this is my codes and what i have understandenter image description here

enter image description here

Advertisement

Answer

The sample code for me does not run. It gives

The reason is that you have 4 columns in your statement but only 3 values in the “values” section for the first insert statement. Either remove the “top_average” column or add a value.

However, that issue has nothing to do with the error you are getting. The screenshot gives it away. You are selecting the following 3 lines

and then running that as a statement. If you select a number of lines in sqldeveloper it will try to run those selected lines only as a statement. It’s not a complete statement so it fails.

To solve it. Put your cursor in before or in the pl/sql block and run the statement. It runs without errors but it doesn’t display anything because the set serveroutput on is missing before the block.

Here is the properly formatted code

  • Properly ident pl/sql
  • changed keywords to upper case, identifiers to lowercase (for readability)
  • renamed variables in pl/sql – see comment.
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement