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

ماهو الفرق بين Rr Fromat و Yy Format ؟؟؟؟؟؟


sasa87

Recommended Posts

السلام عليكم انا عندي كام سوال وارجو الاجابة عليهم:
1- ما هو الفرق بين RR fromat and YY fromat ارجو التوضيع مع مثال لها.
2- مالمقصود بــ function based index ارجواااااااا التوضيع ايضا مع مثلا.
3- مالفائده من استخدام lpad and rpad
4- يوجد داخل DLL امر اسمه comment مافائدة هذا امر.
5- يوجد داخل DML امر اسمه merge مافائدته ايضا.
اعذروني على الاسئله بس انا لسه مخلص اول جزء في SQL وهذاي بعض الاشياء التي لم استطع فهمها
ارجو من الجميع المساعده ولا تبخلو علينا

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

الاخ الكريم
تلك بعض الاجابات ارجوا ان تكون مفيدة وسوف اقوم الاجابة عن الاسئلة الباقية لاحقا ان شاء الله

3 –استخدام LPAD , RPAD

LPAD(x, width [, pad_string])
تسخدم لملء المسافات الموجودة يمين rpad او يسار lpad رقم معين X بتكرار حرف pad_string حتى طول معين ممكن استخدامها فى طباعة المبالغ المالية

select lpad ( 100,10,'*') , rpad (100,10,'*' ) from dual ;

LPAD(100,10,'*') RPAD(100,10,'*')
*******100 100*******


4 –امر comment

لاضافة ملاحظة على الجدول او العمود وتظهر فى حالة استعراض Data Dictionary
Ex :
COMMENT ON TABLE employees IS 'An example of comment statement ';

select * from USER_TAB_COMMENTS;

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

لا شكر على واجب
هذا الاقتباس من ORACLE Materials SQL Fundamental II

The MERGE Statement


Provides the ability to conditionally update or insert data into a database table
Performs an UPDATE if the row exists, and an INSERT if it is a new row:
Avoids separate updates
Increases performance and ease of use
Is useful in data warehousing applications



MERGE INTO table_name table_alias
USING (table|view|sub_query) alias
ON (join condition)
WHEN MATCHED THEN
UPDATE SET
col1 = col_val1,
col2 = col2_val
WHEN NOT MATCHED THEN
INSERT (column_list)
VALUES (column_values);

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

This document comes from Metalink:
What is the difference between the YY and RR format masks?
The RR format mask was introduced to deal with end-of-century issues for 2-digit format masks. A problem arises when using a 2-digit year. "12" could mean "2012" or it could mean "1912" for example. The YY format mask always assumes that the 2 digits are the year in the "current" century. So "12" with a format mask of "YY" now means "2012" but if the same application ran in 1998 the same input would have been read as "1912".
The "RR" format mask shifts this cut-of point by 50 years. Obviously you can still only define a period of 100 years with a 2 digit number so there is no fool-proof case. When using the "RR" format mask every value 00 to 49 means this same century as long as we're currently before year 50 as well, if we're currently after year 50 a value of 00 to 49 is read as a year in the next century. The same is true the other way around. If we're currently before year 50 then a value of 50 to 99 is read as the previous century and a value of 00 to 49 is read as the current century. So the four cases are like this:

in 1998 a value of "05" (with format mask "RR") means 2005
in 1998 a value of "95" (with format mask "RR") means 1995
in 2003 a value of "05" (with format mask "RR") means 2005
in 2003 a value of "95" (with format mask "RR") means 1995
So by using this format mask there are no problems when the century changes, however when RR is used as a format mask new problems will arise when the year 2050 comes closer so by then the format mask YY will have to be used again. As a consequence we advise to always use a 4-digit year to resolve these problems completely (or at least for the next 8000 years).

What is the difference between the YYYY and RRRR format masks?
When the RR format mask was introduced (see above), RRRR also became a valid format mask.
However, when a 4-digit year is used there can be no question what you mean. 2003 is always the year 2003, 1996 is always the year 1996. Therefore the format masks YYYY and RRRR are exactly the same.

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

يوجد داخل DLL امر اسمه comment مافائدة هذا امر؟

Comment :لاضافة ملاحظات على الجدول او العمود كتعريف اسم الجدول او العمود بالعربي او اى ملحوظة تحطها مثلاً:
comment on table TAB_USERS is 'مستخدمين النظام';
# الجملة السابقة توضح اسم بالجدول و منه يمكن تحديد فائدته


comment on column TAB_USERS.SEC_FLAG is 'درجة الصلاحية:1=NORMAL,2=HIGH';
# يبين فائدة العمود وهو يوضح درجة صلاحية المستخدم
1: صلاحية عادية
2: صلاحية سرية

والComment بيقيد عند عمل الديزاين فى الشاشة وكمان بيفيد معرفة معلومات اضافيةعن الSchema

ملحوظة: الCOMMENT ممكن يكون عربي او انجليزي

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

السلام عليكم ورحمة الله وبركاته اخي فالله
بعد التحية
اخي فالله مثال توضيحي بسيط

SELECT TO_DATE(80,'RR'),TO_DATE(80,'YY') FROM DUAL;



الناتج

TO_DATE(80,'RR'),TO_DATE(80,'YY')
---------------- ----------------
01/07/1980,01/07/2080


يتضح من المثال السابق ان RR اذكي بحيث انها رجعت الى 1980 ولكن YY راحت الى 2080

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

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

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

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

×   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.

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

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

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