I have the following piece of statement entered into MySQL5.6 Command Line Client. However, the following error was received. I haven't even been able to add in END// Delimiter; after the select statement.
At the same time, i was wondering after the stored procedure has been created successfully, how do i CALL the stored procedure without the command line but using java codes.
Kindly assist. Greatly appreciated!
give space between delimiter
and //
. After your select
statement write end;
on next line and //
at last line (after end;
in next new line)
delimiter //
create procedure GetUStocks()
Begin
Select * From buystocks;
end;
//
You need a space between DELIMITER and the symbol you are changing the delimiter to.
mysql> DELIMITER //
The clue that it worked should be that you get another mysql>
prompt instead of the "unfinished command" prompt ->
.
Re your comment, if you need to call a stored procedure from a Java application, refer to the manual on callable statements: http://dev.mysql.com/doc/refman/5.6/en/connector-j-usagenotes-statements-callable.html
mysql> delimiter //
mysql> CREATE PROCEDURE GetUStocke()
-> BEGIN
-> SELECT * FROM buystocks ;
-> END//
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.