الانتقال إلى المحتوى

هل هذا الكود صحيح برمجيا


hazeb03

Recommended Posts

أود السؤال هل هذا الكود صحيح برمجيا من أجل الفحص وإعادة رساله في حالة وجد اسم المستخدم؟ أو هناك كود أكثر منطقيا منه
والعفو منكم :angry: :(
create or replace procedure add_useraccount(p_username in privilege.username%type,
p_password in privilege.password%type,
p_privi in privilege.username%type,
p_error out varchar2)
is
v_username privilege.username%type;
ch boolean:=false;
cursor user_cursor is
select username
from privilege;
begin
open user_cursor;
loop
fetch user_cursor into v_username;
if (v_username=p_username) then
ch:=true;
end if;
exit when ((user_cursor%notfound) or (user_cursor%notfound is null));
end loop;
close user_cursor;
if not(ch) then
insert into privilege
values(p_username,p_password,p_privi);
commit;
else
p_error:='the user and password is found';
end if;
end add_useraccount;
/

رابط هذا التعليق
شارك

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   تمت استعادة المحتوى السابق الخاص بك.   مسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

جاري التحميل
×
×
  • أضف...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية