を作成することはできません、それは一般的にストアドプロシージャに来るとき、私はnoobのビットんだけど、私ははmysqlのストアドプロシージャ
Create procedure clone_perms
as
declare @new_id varchar(30), @old_id varchar(30)
declare get_perms cursor for select userspermsUserid, userspermsPermission from users_permissions where [email protected]_id
declare @perms varchar(30), @on_off boolean
FETCH get_perms into @perms, @on_off
while(@@sqlstatus=0)
BEGIN
if exists (select 1 from permissions where [email protected]_id and [email protected])
BEGIN
update permissions set [email protected]_off where [email protected]_id and [email protected]
END
else
BEGIN
insert permissions (userspermsUserID, userspermsPermID, userspermsPermission) values (@new_id, @perms, @on_off)
END
FETCH get_perms into @perms, @on_off
END
CLOSE get_perms
DEALLOCATE CURSOR get_perms
end
次のように記述しようとしています。
/* SQLエラー(1064):SQL構文にエラーがあります。あなたのMySQLサーバのバージョンに対応するマニュアルをチェックして、正しい構文を使用してください。 'near declare @new_id varchar(30)declare @old_id varchar(30)declare get_perm' 2行目/
私はこの仕事をするために何をする必要があるのか誰にも分かっていますか? CREATE PROCEDURE clone_perms
ないAS
ご質問にサーバのバージョンを含めてください –
私は5.1.45コミュニティを使用しています – Jonathan