الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Practice In Trigger And Procedure

Featured Replies

بتاريخ:
set serveroutput on
create or replace procedure check_salary (v_job_id  in employees.job_id%type,v_salary in employees.salary%type) is
declare
min_sal number;
max_sal number;
begin
select min(salary),max(salary) into min_sal,max_sal
from emloyees
where job_id = v_job_id;
if not (v_salary between min_sal and max_sal)
then
dbms_output.put_line('error');
--raise_application_error(22222,'Invalid salary <sal>. Salaries for job <jobid> must be between <min> and <max>');
end if;
end check_salary;

-----------------------------------------------------------------------------------------------------------------------------------------------------

 

create or replace trigger check_salary_trg 
before insert or update  on employees
for each row
declare
begin
-----here call procedure
end;

 

 

 

 

-------------------------------------------------------------------

practice in trigger

 but i reached to this point but i don't know this correct or not

 it gives me compilation error

if any one have solutions of practices in pl/sql of oracle 10g

can send to me

i want it necessary

 

  The rows in the JOBS table store a minimum and maximum salary allowed for different JOB_ID values. You are asked to write code to ensure that employees’ salaries fall in the range allowed for their job type, for insert and update operations.

a.  Write a procedure called CHECK_SALARY that accepts two parameters, one for an employee’s job ID string and the other for the salary. The procedure uses the job ID to determine the minimum and maximum salary for the specified job. If the salary parameter does not fall within the salary range of the job, inclusive of the minimum and maximum, then it should raise an application exception, with the message “Invalid salary <sal>. Salaries for job <jobid> must be between <min> and <max>”. Replace the various items in the message with values supplied by parameters and variables populated by queries.

b.  Create a trigger called CHECK_SALARY_TRG on the EMPLOYEES table that fires before an INSERT or UPDATE operation on each row. The trigger must call the CHECK_SALARY procedure to carry out the business logic. The trigger should pass the new job ID and salary to the procedure parameters.

تم تعديل بواسطة منمون علي

بتاريخ:

اعملي show errors لتكتشفي الخطأ ... 

بتاريخ:
  • كاتب الموضوع

اعملي show errors لتكتشفي الخطأ ... 

هوة اداني الارور ده

Warning: Procedure created with compilation errors.

Errors for PROCEDURE CHECK_SALARY:

 

LINE/COL ERROR 2/1 PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following: begin function package pragma procedure subty pe type use <an identifier> <a double-quoted delimited-identif ier> form current cursor external language The symbol "begin" was substituted for "DECLARE" to continue.

 

 

------------------------ الكود-------------------

 

set serveroutput on
create or replace procedure check_salary (v_job_id  in employees.job_id%type,v_salary in employees.salary%type) is
declare
min_sal number;
max_sal number;
begin
select min(salary),max(salary) into min_sal,max_sal
from emloyees
where job_id = v_job_id;
if not (v_salary between min_sal and max_sal)
then
dbms_output.put_line('error');
--raise_application_error(22222,'Invalid salary <sal>. Salaries for job <jobid> must be between <min> and <max>');
end if;
end check_salary;
end;
/
show error

تم تعديل بواسطة منمون علي

بتاريخ:

جربي اشطبي كلمة declare نهائياً أتوقع أن ال error سيختفي ...

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

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

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

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

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

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.