我在 MySQL 中有這個查詢
create function is_prime(num int) returns boolean
begin
declare cont;
set cont = 2;
while(cont != num) do
if (num % cont = 0) then
return false;
end if;
cont = cont 1;
end while;
return true;
end//
VSCode 顯示語法錯誤。我檢查了每一行,但我沒有看到錯誤。謝謝和對不起我的英語。
uj5u.com熱心網友回復:
宣告必須有一個資料型別
你也忘了設定增加
DELIMITER //
create function is_prime(num int) returns boolean
begin
declare cont INTEGER;
set cont = 2;
while(cont != num) do
if (num % cont = 0) then
return false;
end if;
SET cont := cont 1;
end while;
return true;
end//
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/461711.html
