Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Example of Using Aggregation on Nested Tables
Example: How many students sat each exam
WITH C_ER AS (SELECT CourseId, CAST (TABLE (SELECT DISTINCT StudentId, Mark FROM EXAM_MARK AS EM WHERE EM.CourseId = C.CourseId) AS ROW ( StudentId SID, Mark INTEGER ) MULTISET) AS ExamResult FROM COURSE AS C) SELECT CourseId, (SELECT COUNT (*) FROM TABLE (ER (ExamResult)) AS t) AS n FROM C_ER
Explanation
CREATE FUNCTION ER
(SM ROW ( StudentId SID, Mark INTEGER ) MULTISET )
RETURNS TABLE (StudentId SID, Mark INTEGER)
RETURN SM;
The type name TABLE ( StudentId SID, Mark INTEGER ) is actually just a synonym for ROW (StudentId SID, Mark INTEGER ) MULTISET). The misleading synonym is available only in a RETURNS clause and not as a parameter type, for example. So ER is actually a no-op, returning its input.
Using Subqueries A subquery is a query (typically enclosed by parentheses) that appears within another SQL data manipulation statement. If evaluated, the subquery gives a va
Closing a Cursor Variable The CLOSE statement disables the cursor variable. After that, the related result set is undefined. The syntax for the same is as shown below: CLOS
What Are Subprograms? The Subprograms are named PL/SQL blocks which can take parameters and be invoked. The PL/SQL has 2 types of subprograms known as the procedure s and func
set serveroutput on declare a number(5); b number(5); c number(5); begin a:=&a; b:=&b; c:=a/b; dbms_output.put_line(c); exception when zero_divide then d
SELECT INTO Statement The SELECT INTO statement retrieve data from one or more database tables, and then assigns the selected values to the variables or fields. Syntax:
Defining REF CURSOR Types To make cursor variables, you take 2 steps. At first, you define a REF CURSOR type, and then declare the cursor variables of that type. You can defin
DELETE Command - SQL Loosely speaking, DELETE removes some existing rows from its target table. Suppose the university decides that course C3 is to be withdrawn. Example shows
Recursive Subprograms The recursive subprogram is the one that calls itself. Think of a recursive call as a call to a few other subprograms that does the similar task as your
Using Operator VALUE: As you may expect, the operator VALUE returns the value of an object. The VALUE takes its argument a correlation variable. For illustration, to return a
What are the rates for help in writing PL/SQL procedures and functions?
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd