PL/SQL Quiz on Variables and Conditions

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

ما هي الوظيفة التي تُستخدم لتغيير حالة الأحرف في V_Lname؟

  • Initcap (correct)
  • Upper
  • Trim
  • Lower

ماذا يعني التعبير 'Like V_Lname' في جملة SQL؟

  • تُستخدم لمطابقة قيمة محددة فقط
  • توجد تطابقات جزئية تسمح بإضافة أحرف إضافية (correct)
  • توجد تطابقات دقيقة فقط
  • توجد مطابقة متقدمة

ما الذي يتم تخزينه في المتغير V_Name بعد تنفيذ الجملة SELECT؟

  • أول اسم للموظف الذي يتطابق مع الشروط (correct)
  • آخر اسم للموظف
  • اسم الموظف بالكامل
  • قيمة الراتب للموظف

ما هو الشرط الذي يجب أن يتحقق في جملة SQL لاختيار الموظف؟

<p>أن يكون الراتب مساويًا لـ 24000 واسم العائلة مطابقًا (C)</p> Signup and view all the answers

ما هي اللغة المستخدمة في الكود المقدم؟

<p>PL/SQL (B)</p> Signup and view all the answers

ما هو نوع البيانات للمتغير v_job؟

<p>varchar2 (A)</p> Signup and view all the answers

ما هي القيمة الافتراضية للمتغير v_total_sal؟

<p>3.17 (C)</p> Signup and view all the answers

ما هي القيمة الثابتة لـ C-TAX-RATIO؟

<p>17.25 (B)</p> Signup and view all the answers

ماذا يعني V_Flag في تعريف المتغير؟

<p>يجب أن يكون صحيحاً (A)</p> Signup and view all the answers

ماذا يحدث إذا كانت الحالة صحيحة؟

<p>يتم تنفيذ الإجراء المحدد. (A)</p> Signup and view all the answers

ما الذي يتم تنفيذه إذا كانت الحالة غير صحيحة؟

<p>يتم تنفيذ إجراء بديل. (C)</p> Signup and view all the answers

ما هي القيمة المستخدمة إذا لم تكن هناك حالة محددة؟

<p>فارغ. (D)</p> Signup and view all the answers

كيف يتم تنظيم الشروط والأفعال في العملية المذكورة؟

<p>شرط واحد مرتبط بإجراء واحد. (B)</p> Signup and view all the answers

ما الذي يحدد الإجراء الذي سيتم تنفيذه في حالة معينة؟

<p>حالة الحالة. (C)</p> Signup and view all the answers

ما هي النتيجة التي ستظهر إذا كانت قيمة V_Myage أقل من 11؟

<p>أنا طفل (B)</p> Signup and view all the answers

ما هي قيمة V_Myage في الشيفرة المقدمة؟

<p>30 (C)</p> Signup and view all the answers

ما هو الغرض من استخدام جملة IF في الشيفرة؟

<p>للتحقق من نوعية الطفولة (B)</p> Signup and view all the answers

ماذا يحدث في جملة ELSE في الشيفرة؟

<p>يتم طباعة 'أنا ليس طفلاً' (B)</p> Signup and view all the answers

كيف يتم كتابة جملة IF في PL/SQL؟

<p>IF شرط THEN إجراء END IF; (C)</p> Signup and view all the answers

ما هي ميزة الــ Overloading في البرمجة؟

<p>يمكن أن تحتوي الإجراءات والدوال في نفس الحزمة على نفس الاسم (C)</p> Signup and view all the answers

ما الهدف من استخدام Parameters في الحزم؟

<p>تحديد سلوك الإجراءات والدوال بناءً على المدخلات (B)</p> Signup and view all the answers

كيف يمكن تمييز بين نوعية الـ Subprogramme في البرمجة؟

<p>بناءً على الوظيفة التي تؤديها (B)</p> Signup and view all the answers

ما هو التأثير السلبي عند استخدام Overloading بشكل غير صحيح؟

<p>زيادة تعقيد الكود (C)</p> Signup and view all the answers

ما هي إحدى الفوائد الأساسية لاستخدام الحزم في PL/SQL؟

<p>تجميع الدوال والإجراءات ذات الصلة معًا (A)</p> Signup and view all the answers

ما هي الغرض من البرنامج الفرعي المذكور في المحتوى؟

<p>توضيح هيكل النظام والمعايير المرتبطة. (C)</p> Signup and view all the answers

أي من الخيارات التالية تعتبر جزءًا من أجزاء البرنامج الفرعي؟

<p>تحديد المواصفات اللازمة للمنتج. (B)</p> Signup and view all the answers

ما هي العناصر التي يتضمنها تحديد المواصفات حسب المحتوى؟

<p>مواصفات تقنية وتطبيقية للمنتج. (D)</p> Signup and view all the answers

كيف يمكن تصنيف جسم البرنامج الفرعي المذكور؟

<p>واحد من أكثر الأجسام تنظيماً. (C)</p> Signup and view all the answers

ما الذي يميز مواصفة حزمة البرنامج الفرعي؟

<p>تتضمن تفاصيل دقيقة ومهمة. (D)</p> Signup and view all the answers

Flashcards

v_job varchar2 (15)

هو متغير من نوع نص (varchar2) له طول 15 حرفًا.

v_count binary-integer := 0

هو متغير من نوع عددي ثنائي (binary-integer) تعيين قيمته الأولية صفر.

v_total_sal number (7.2) := 3.17

هو متغير من نوع عددي (number) يحتوي على 7 أرقام قبل الفاصلة العشرية و 2 أرقام بعدها. قيمته الأولية 3.17 .

INITCAP

دالة تحويل الحرف الأول في كل كلمه لحرف كبير

Signup and view all the flashcards

V_Lname Varchar2(20)

تعريف متغير من نوع VARCHAR2 بطول 20 حرف

Signup and view all the flashcards

V_Lname := Initcap( ' KING' )

تعيين قيمه لمتغير مع استخدام داله Initcap

Signup and view all the flashcards

V_Name Varchar2(20)

تعريف متغير من نوع VARCHAR2 بطول 20 حرف

Signup and view all the flashcards

Select First_Name into V_Name

جملة PL/SQL تعمل علي استرجاع البيانات وتعيينها إلى متغير

Signup and view all the flashcards

عبارة IF

هي عبارة عن كتلة من التعليمات يتم تنفيذها عندما يكون الشرط صحيحًا.

Signup and view all the flashcards

شرط IF

الشرط الذي يتم اختباره في العبارة IF

Signup and view all the flashcards

تعليمات IF

تُستخدم لمجموعة من التعليمات التي يتم تنفيذها إذا كان شرط IF صحيحًا.

Signup and view all the flashcards

تعليمات ELSE

مجموعة من التعليمات التي يتم تنفيذها إذا كان شرط IF غير صحيح.

Signup and view all the flashcards

END IF

بيان PL/SQL الذي يحدد بدء ونهاية العبارة IF.

Signup and view all the flashcards

IF...THEN

أمر يشير إلى تنفيذ إجراء معين عند تحقيق شرط معين.

Signup and view all the flashcards

Condition

الشرط الذي يجب تقييمه لمعرفة ما إذا كان سيتم تنفيذ الإجراء.

Signup and view all the flashcards

Action

الإجراء الذي سيتم تنفيذه عند تحقيق الشرط.

Signup and view all the flashcards

True

عندما يكون الشرط صحيحًا، يُنفذ الإجراء.

Signup and view all the flashcards

False

عندما يكون الشرط غير صحيح، لا يُنفذ الإجراء.

Signup and view all the flashcards

Subprogramme

هو جزء من البرنامج يحتوي على مجموعات من البيانات والتعليمات المتعلقة بمشكلة معينة او مجال معين.

Signup and view all the flashcards

Package

مجموعة متكاملة من البيانات والتعليمات والوظائف المصممة حل مشكلة ما او لتنفيذ مهمة محددة.

Signup and view all the flashcards

Overloading

هو مصطلح يصف إمكانية وجود عدة Procedures أو Functions داخل نفس Package مع نفس الاسم ة لكن مع Parameters (مدخلات) مختلفة أو بترتيب مختلف.

Signup and view all the flashcards

Package Variables

عبارة عن متغيرات تُعرّف داخل Package وتُستخدم من قبل Subprogrammes المتعددة داخل نفس Package.

Signup and view all the flashcards

Dependency between Packages

هو Package يوثّر على جميع Subprogrammes داخل Package آخر. مثلاً، Package A يحدث Package B لو كان Package B مستخدماً Package A و Package A قُدم بـ Update .

Signup and view all the flashcards

Test Package

هو Package يُستخدم لاختبار Subprogrammes داخل Package . مثلاً، Package Test يستخدم لفحص Subprogrammes داخل Package A.

Signup and view all the flashcards

Study Notes

PL/SQL Course

  • This course covers PL/SQL, a procedural language extension to SQL
  • It includes features of procedural programming to enhance SQL
  • SQL statements are embedded within PL/SQL code
  • Code is stored in the database and called upon for execution
  • Variables and constants, along with conditional statements (IF statements) and loops, are used
  • PL/SQL offers modular programming (nested blocks, and libraries for reusability)
  • Integration with Oracle products like JDeveloper
  • Portability across different operating systems
  • Exception handling for error management

Introduction to PL/SQL

  • PL/SQL extends SQL with procedural features
  • SQL queries can be included within PL/SQL code
  • Stored code in databases is directly callable
  • PL/SQL enables variable and constant declarations
  • Conditional statements (IF-THEN-ELSE) and loops for repetitive tasks
  • Code can be written and executed once, then used multiple times
  • Modularity, integration, portability and exception handling are features of PL/SQL
  • It's implemented within Oracle Database

PL/SQL Block Structure

  • Declarative Section: Variable definitions, cursors
  • Executable Section: SQL statements, PL/SQL statements
  • Exception Section: Error handling
  • Each block requires BEGIN and END keywords
  • Variables, cursors and constants are optional aspects of declaration
  • SQL and PL/SQL statements are located here
  • Exception handling can be done here

PL/SQL Block Types

  • Anonymous Block: A block without a name, executed where defined
  • Subprograms: Blocks that accept parameters, stored in databases (procedures and functions)

Writing Executable Statements

  • Single-line comments begin with "--"
  • Multi-line comments start with "/" and end with "/"
  • Comments improve code readability and maintainability
  • PL/SQL supports SQL functions (e.g., decode, group functions) for use within blocks

SQL Functions in PL/SQL

  • Integration of SQL functions into PL/SQL code using the syntax: InitCap(String) for example
  • Example calls include InitCap('king')

Nested Blocks

  • Inner blocks can access variables in outer blocks, but outer blocks cannot access variables in inner blocks directly
  • Sub-block can have own declaration or values for same variables as outer block.

Operators in PL/SQL

  • Similar to SQL, PL/SQL supports logical, arithmetic and concatenation operators
  • Parentheses dictate order of operations
  • Qualifiers are used to refer to particular variables, so that variables with same names from different blocks are not confused. (outer vs inner blocks)

Interacting with the Oracle Server

  • Data manipulation statements (INSERT, UPDATE, DELETE) are supported
  • SQL statements are executed through PL/SQL.

SQL Cursors (Implicit and Explicit)

  • Implicit cursors: implicitly declared and managed by Oracle for SQL statements
  • Explicit cursors: declared and managed by the programmer for greater control and to handle data efficiently

Handling Exceptions

  • Predefined exceptions: Oracle-provided error messages
  • User-defined exceptions: programmer-defined error messages for better presentation of errors
  • PL/SQL code provides an Exception handling section where errors can be managed and handled by programmer

PL/SQL Program Units

  • Stored Procedures: Reusable code blocks for executing more complex operations
  • Stored Functions: Reusable blocks that return a value

Working with Composite Data Types

  • Records: complex data structures with multiple fields
  • Collections (Index-By Tables, Nested Tables, and Varrays): organize multiple related values

PL/SQL Collections

  • Index-By Tables: collections with named indexes for efficient access to elements
  • Nested Tables: collections with similar data types, stored within other data structures
  • Varrays: collections with fixed size and better performance for homogeneous data types

Using PL/SQL Collections with Index-By Tables and other Types

  • Using PL/SQL collections, such as Index-by Tables and other type, within the code

Creating Packages

  • Packages: Bundles of procedures, functions, and variables for enhanced code organization and reuse

Viewing PL/SQL Objects in Data Dictionary

  • Tools for viewing and examining PL/SQL objects (procedures, functions, and packages) saved in the database

More Package Concepts and Overloading

  • Package overloading: allows using the same name for multiple subprograms (procedures or functions) within a package, differentiating them through parameter counts or parameter types

PL/SQL Procedures and Functions with Parameters

  • Procedures and Functions: reusable blocks of PL/SQL code that can accept parameters
  • Parameters can be passed as IN, OUT, or IN OUT, defining how they are used in procedures

Pass by Value, Pass by Reference; IN, OUT, IN OUT parameters

  • IN, OUT, IN OUT are used to define how parameters are used in procedures
  • Using Positional notation, Named notation, or Combination notation for passing parameters

Forward Declarations

  • Necessary if procedures or functions are used before they are defined in the code

Contact Information

  • Contact information for the course instructor is included

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

PL/SQL Triggers Quiz
5 questions
PL/SQL and Database Management Quiz
5 questions

PL/SQL and Database Management Quiz

SustainableLepidolite4776 avatar
SustainableLepidolite4776
PL/SQL Quiz
5 questions

PL/SQL Quiz

ThriftyErudition avatar
ThriftyErudition
Use Quizgecko on...
Browser
Browser