This question is from DATABASE Course Copy and run the following code and run it
ID: 3803002 • Letter: T
Question
This question is from DATABASE Course
Copy and run the following code and run it in SQL then answer the question that follows:
CREATE OR REPLACE TYPE vcarray AS VARRAY(10) OF VARCHAR2(128);
/
CREATE TABLE varray_table (id number primary key, col1 vcarray);
INSERT INTO varray_table VALUES (1, vcarray('A'));
INSERT INTO varray_table VALUES (2, vcarray('B', 'C'));
INSERT INTO varray_table VALUES (3, vcarray('D', 'E', 'F'));
3.1 Write an anonymous block to display the following output:
ID: 1
A
ID: 2
B
C
ID: 3
D
E
F
Explanation / Answer
Thwo Blocks would be required to perform and fetch the resuired values for the data fields:
Following piece of code indicates a user in creating his own datatypes , precisely user defined datatypes.
Code block 1 : Select data from table (unnesting the collection)
SELECT t1.id, t2.column_value
Code block 2: Extract data
set serveroutput on
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.