Table literals - sql, PL-SQL Programming

Table Literals - SQL

One might expect SQL to support table literals in the manner illustrated in Example 2.2, but in fact that is not a legal SQL expression.

Example: Not a Table Literal

TABLE (

ROW (StudentId 'S1', CourseId 'C1', Name 'Anne'),

ROW (StudentId 'S1', CourseId 'C2', Name 'Anne'),

ROW (StudentId 'S2', CourseId 'C1', Name 'Boris'),

ROW (StudentId 'S3', CourseId 'C3', Name 'Cindy'),

ROW (StudentId 'S4', CourseId 'C1', Name 'Devinder') 

);

It is illegal because row literals in SQL do not use column names. Instead, the column values must be written in the appropriate order, reflecting the order of the columns of the table, as in

ROW ('S1', 'C1', 'Anne')

Moreover, the word VALUES is used in place of TABLE, parentheses is not used around the list of row literals, and the key word ROW is in fact optional.

Posted Date: 1/18/2013 2:13:23 AM | Location : United States







Related Discussions:- Table literals - sql, Assignment Help, Ask Question on Table literals - sql, Get Answer, Expert's Help, Table literals - sql Discussions

Write discussion on Table literals - sql
Your posts are moderated
Related Questions
Loop Labels Like the PL/SQL blocks, loops can also be labeled. The label, an undeclared identifier enclosed by double angle brackets, should appear at the beginning of the LOOP

Joining in SQL Joining IS_CALLED and IS_ENROLLED_ON in SQL SELECT * FROM IS_CALLED NATURAL JOIN IS_ENROLLED_ON This is an example of an SQL table expression. I have been

Special cases of projection This section describes the identity projection, r {ALL BUT}, and the projection on no attributes, r { }, which yields TABLE_DUM when r is empty, ot

CLOSE Statement The CLOSE statement allows the resources held by a cursor variable or open cursor to be reused. No more rows can be fetched from the cursor variable or closed

Effects of NULL in Aggregate Operator - SQL Let aggop(x) be an invocation of some aggregate operator aggop in SQL, where x is an expression (usually an open expression) to be

Example of WRAP Operator - SQL The effect of Example can be obtained in SQL but note that one needs to write down not only the names of the columns being wrapped but also the

Keys in SQL SQL support for keys in the following respects: SQL does not require at least one key for every base table. If no key is explicitly declared, then KEY {ALL B

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

Parameter Aliasing   To optimize the subprogram call, the PL/SQL compiler can decide between the two techniques of the parameter passing. With the by-value techniques, the v

Use of Table Comparisons - SQL Table comparisons where it is noted that although table expressions cannot be compared, we have TABLE (t) to convert a table expression t into