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

  • تسجيل الدخول عبر الفيس بوك تسجيل الدخول عبر تويتر Log In with LinkedIn Log In with Google      تسجيل دخول    
  • إنشاء حساب

صورة
- - - - -

Need Help To Make This Functions


4 رد (ردود) على هذا الموضوع

#1 free2000000

free2000000

    عضو

  • الأعضــاء
  • 9 مشاركة

تاريخ المشاركة 26 March 2010 - 07:00 PM

Create a package, which contains the following functions and procedures, in the HR account.
1. A function that has one input parameter of type NUMBER, and returns the square of its input.
2. A function that has three input parameters of type NUMBER, and returns the minimum of its three
inputs.
3. A function that has one input parameter of type INTEGER. The function returns TRUE if its input is a
prime number and FALSE if its input is not a prime number. A prime number (or a prime) is a natural
number that has exactly two distinct natural number divisors: 1 and itself. Here is a list of the first
twenty prime numbers: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71.
4. A procedure that shows the names of employees (lastName, firstName) sorted by last name.
5. A procedure that shows the names of employees (firstName lastName) salaries less than 10000.
6. A procedure that shows the names of countries sorted by region id.
In implementing the 3rd function, you can search the web for algorithms on prime numbers. These algorithms
may be written in other programming languages. However, you will get the idea on how to
implement the function. Here is a prime testing algorithm written in Python. You may also need to get
familar with some PL/SQL data types (Figure 1). To get more information, see this PL/SQL datatypes. You
may need the MOD function in your implementation.

ملفات مرفقة

  • ملف مرفق  0222.JPG   129.65كيلو   30 عدد مرات التحميل

0101.png


#2 free2000000

free2000000

    عضو

  • الأعضــاء
  • 9 مشاركة

تاريخ المشاركة 01 April 2010 - 04:08 AM

i work in this package a litle but i have some errors can any one correct these for me pleas

ملفات مرفقة

  • ملف مرفق  01.txt   2.06كيلو   39 عدد مرات التحميل
  • ملف مرفق  02.txt   1.04كيلو   12 عدد مرات التحميل

0101.png


#3 burhanse2002

burhanse2002

    عضو

  • الأعضــاء
  • 2 مشاركة

تاريخ المشاركة 19 April 2010 - 05:07 PM

CREATE OR REPLACE FUNCTION TEST.max_number (
p_number_a IN NUMBER,
p_number_b IN NUMBER,
p_number_c IN NUMBER
)
RETURN NUMBER
AS
v_number_a NUMBER;
v_number_b NUMBER;
v_number_c NUMBER;
v_max NUMBER;
BEGIN
v_number_a := p_number_a;
v_number_b := p_number_b;
v_number_c := p_number_c;

IF v_number_a > v_number_b AND v_number_a > v_number_c
THEN
v_max := v_number_a;
ELSIF v_number_b > v_number_a AND v_number_b > v_number_c
THEN
v_max := v_number_b;
ELSIF v_number_c > v_number_a AND v_number_c > v_number_b
THEN
v_max := v_number_c;
END IF;

RETURN v_max;
END;

#4 burhanse2002

burhanse2002

    عضو

  • الأعضــاء
  • 2 مشاركة

تاريخ المشاركة 19 April 2010 - 05:10 PM

CREATE OR REPLACE FUNCTION TEST.square_number (p_number IN NUMBER)
RETURN NUMBER
AS
v_number NUMBER;
BEGIN
v_number := p_number;
v_number := v_number * v_number;
RETURN v_number;
END;[يسار][/يسار]

#5 @nana@

@nana@

    عضو نشط

  • الأعضــاء
  • 284 مشاركة
  • البـلـد: Country Flag
  • الاهتمامات:Don't Say ,I Don't Know..But Try&& Error :(
    I Adore Oracle 4 Ever :D

تاريخ المشاركة 19 April 2010 - 07:07 PM

2. A function that has three input parameters of type NUMBER, and returns the minimum of its three
inputs.

create or replace function minnum(v_a number,v_b number,v_c number)
return number
is
begin if(v_a<v_:rolleyes: then
if(v_a<v_c) then
return v_a;
elsif(v_a>v_c) then
return v_c;
end if;
elsif(v_a>v_:lol: then
if(v_b<v_c) then
return v_b;
elsif(v_b>v_c) then
return v_c;
end if;
end if;
end
;


FatmaElgzar
https://www.facebook...acleJavaAcademy

http://www.facebook....gDream.Computer
Try 2 Change Ur Life 2 The Best
---------------------------------------
ياحى ياقيوم برحمتك أستغيث ، أصلح لى شأنى كله ولاتكلنى الى نفسى طرفة عين .

حسبى الله لااله الا هو ، عليه توكلت وهو رب العرش العظيم
--------------------------------------------------
905527214.gif