Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews DB Oracle Interviews:Concepts and ArchitectureData AccessDatabase ArchitectureDatabase ManagementDatabase Security OracleDistributed ProcessingFlexfieldForms ReportsGeneral OracleMemory ManagementMTO-SAP Financial AccountingOCIOracle AOLOracle AROracle Backup RecoveryOracle D2KOracle DatabaseOracle Database DeveloperOracle DB OptimizationOracle DBAOracle DeveloperOracle ETLOracle Forms 3.0Oracle Forms 4.0Oracle GLOracle PL-SQLOracle RMANOracle ScenariosOracle SecurityOracle SQLOracle System ArchitectureOracle Technology Network (OTN)Programmatic ConstructsRAC (Real Application Clusters)SQL Plus
Copyright © 2018. All Rights Reserved
Oracle Database Interview Question:
How To Create an Array in PL/SQL?
Submitted by: AdministratorIf you want create an array data structure, you can use the collection type VARRAY. VARRAY stands for Variable Array. Here is a sample script on how to use VARRAY:
SQL> set serveroutput on;
SQL> DECLARE
2 TYPE list IS VARRAY(3) OF VARCHAR(16);
3 domain_list list;
4 BEGIN
5 domain_list := list('google','globalguideline','myspace');
6 DBMS_OUTPUT.PUT_LINE('Second domain: '
7 || domain_list(2));
8 END;
9 /
Second domain: globalguideline
As you can see, to define an array variable, you need to create your own array type, and use that type to define array variables.
Submitted by: Administrator
SQL> set serveroutput on;
SQL> DECLARE
2 TYPE list IS VARRAY(3) OF VARCHAR(16);
3 domain_list list;
4 BEGIN
5 domain_list := list('google','globalguideline','myspace');
6 DBMS_OUTPUT.PUT_LINE('Second domain: '
7 || domain_list(2));
8 END;
9 /
Second domain: globalguideline
As you can see, to define an array variable, you need to create your own array type, and use that type to define array variables.
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.