Home » SQL & PL/SQL » SQL & PL/SQL » What is the proper termination for a stored procedure created from C# code? (Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production 0 Windows)
What is the proper termination for a stored procedure created from C# code? [message #682551] Wed, 28 October 2020 11:01 Go to next message
Darth Waiter
Messages: 74
Registered: October 2020
Member
It's a semicolon:
END;

[Updated on: Wed, 28 October 2020 11:17]

Report message to a moderator

Re: What is the proper termination for a stored procedure created from C# code? [message #682552 is a reply to message #682551] Wed, 28 October 2020 12:05 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Do not mistake SQL for PL/SQL; and language and the tool you use for it.
A PL/SQL statement ends with a semi-colon.
A SQL statement has not ending character.
The tool you use to send a SQL statement may have a character to end a statement which means to send the statement to Oracle.

For instance SQL*Plus, for SQL, default termination character is ';' but you can change it:
SQL> select * from dual;
D
-
X

1 row selected.

SQL> set sqlterminator '$'
SQL> select * from dual$
D
-
X

1 row selected.

SQL> select * from dual;
  2  $
select * from dual;
                  *
ERROR at line 1:
ORA-00911: invalid character


SQL> set sqlterminator off
SQL> select * from dual
  2  /
D
-
X

1 row selected.

SQL> select * from dual;
  2  /
select * from dual;
                  *
ERROR at line 1:
ORA-00911: invalid character
For PL/SQL, as PL/SQL statement ends with a ';', you must always tells SQL*Plus the PL/SQL block is ended using '/':
SQL> begin null; end;
  2
  3
  4
  5
  6
  7
  8
  9
 10  /

PL/SQL procedure successfully completed.

[Updated on: Wed, 28 October 2020 12:06]

Report message to a moderator

Re: What is the proper termination for a stored procedure created from C# code? [message #682553 is a reply to message #682552] Wed, 28 October 2020 14:06 Go to previous messageGo to next message
Darth Waiter
Messages: 74
Registered: October 2020
Member
When I create a stored procedure from C# via .NET connector, which is it - PL/SQL or SQL?
Re: What is the proper termination for a stored procedure created from C# code? [message #682555 is a reply to message #682553] Wed, 28 October 2020 14:22 Go to previous message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

CREATE PROCEDURE is a SQL statement.
The body of the procedure is PL/SQL; so its ends with a ";".

See SQL Language Reference, CREATE PROCEDURE:

Quote:
CREATE [ OR REPLACE ] [ EDITIONABLE | NONEDITIONABLE ] PROCEDURE plsql_procedure_source
(plsql_procedure_source: See Oracle Database PL/SQL Language Reference.)
Previous Topic: A query that works in SquirrelSLQL fails in C#
Next Topic: Improve Performance of Insert and Update on same table
Goto Forum:
  


Current Time: Thu Mar 28 03:45:28 CDT 2024