0
CREATE OR REPLACE FUNCTION DELETE_ALL_STUDENTS RETURN NUMBER AS
BEGIN
DELETE FROM STUDENTS;
END;

Above is my function which i believe works fine. Here is my procedure:

CREATE OR REPLACE PROCEDURE DELETE_ALL_STUDENTS_VIASQLDEV AS
BEGIN
dbms_output.put_line('--------------------------------------------');
dbms_output.put_line('Deleting all customer rows);

END;

For some reason when i run this procedure i keep getting error: PLS-00103.

Anyone know whats wrong with my code?I want the code to delete all records from the student table and then in the script output window i want it to display the hyphens and then:

'deleting all student rows'.

Ankit
  • 5,733
  • 2
  • 22
  • 23
J.Doe
  • 11
  • 5
  • 1
    There's a `/` missing after the last line. See [here](https://stackoverflow.com/questions/20334067/pls-00103-encountered-the-symbol-create). – yacc Aug 19 '17 at 05:28
  • Please check your query, and try to read more [here](https://www.w3schools.com/sql/sql_delete.asp). `DELETE FROM STUDENTS;` need some constrains. – wpcoder Aug 19 '17 at 05:29
  • @wpcoder It is supposed to "Delete All Students" so it really doesn't need constraints. – user681574 Aug 19 '17 at 05:31
  • i just added the / and im still getting the same error? @yacc – J.Doe Aug 19 '17 at 05:34
  • there is a quote mark missing `'Deleting all customer rows(add ' here)` – wpcoder Aug 19 '17 at 05:36
  • [MySQL](https://dev.mysql.com/doc/refman/5.7/en/) and [Oracle Database](http://docs.oracle.com/cd/E11882_01/server.112/e41084/toc.htm) are different software packages, even if they are produced now by the same company. Both implement SQL but they extend it in different ways and sometimes they use different syntax conventions that render the queries incompatible between them. Please use only the tags that match the software you are using. – axiac Aug 19 '17 at 05:50

1 Answers1

0

unclosed quote mark:

dbms_output.put_line('Deleting all customer rows);

should be:

dbms_output.put_line('Deleting all customer rows');
wpcoder
  • 1,016
  • 11
  • 17
  • Thanks! i just tried to run the following anonymous block but for some reason the records arent being deleted. SET SERVEROUTPUT ON begin DELETE_ALL_STUDENTS_VIASQLDEV; ADD_STUDENTS_VIASQLDEV(1,'brad Smith'); ADD_STUDENTS_VIASQLDEV(2,' Mike Davis'); ADD_STUDENTS_VIASQLDEV(3,'Emily Jones'); end; – J.Doe Aug 19 '17 at 05:54
  • Please refer to [this tutorial](https://www.tutorialspoint.com/plsql/plsql_functions.htm), for example within your function you didn't add `BEGIN...RETURN something; END;` , also what error you getting? – wpcoder Aug 19 '17 at 06:37
  • For some reason? If `DELETE_ALL_STUDENTS_VIASQLDEV` is as you described it in your post, it does not delete anything. – Lennart - Slava Ukraini Aug 19 '17 at 09:08
  • dose it produce any error message? what it display? also as @yacc participated add / at last line. – wpcoder Aug 19 '17 at 09:22