Exam 1z0-149 All QuestionsBrowse all questions from this exam
Question 5

Which two are true about INDEX-BY tables? (Choose two.)

    Correct Answer: A, B

    INDEX-BY tables in PL/SQL, also known as associative arrays, must use an integer index. They cannot be created with the CREATE TYPE statement; they can only be defined within PL/SQL blocks. The index must be an integer, and not a string, making the options that state so incorrect.

Discussion
FestoOptions: AC

A $ C ARE CORRECT

PurpleStudioOptions: AC

A and C are TRUE!

Wahaj_2023Options: AD

A AND D , C IS NOT BEC (ONLYE)

thranduylOptions: AC

A.C TESTED

2oracleexamOptions: AC

My bad, didn't check. D is not true. Checked in Oracle DB 12.1.0.2.0 Compilation errors for TYPE APPS.PHONEBOOK Error: PLS-00355: use of pl/sql table not allowed in this context Line: 1 Text: CREATE OR REPLACE TYPE PhoneBook AS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER Error: PL/SQL: Compilation unit analysis terminated Line: 1 Text: CREATE OR REPLACE TYPE PhoneBook AS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER A and C is true.

2oracleexamOptions: AD

A and D. You can create type INDEX BY, example from ChatGPT: CREATE TYPE PhoneBook AS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER; After creating this type, you can use it to declare variables or columns in tables. For instance, you might use it within PL/SQL code like this: DECLARE -- Declare a variable of type PhoneBook myContacts PhoneBook; BEGIN -- Assign values to the INDEX-BY table myContacts(1) := 'John Doe'; myContacts(2) := 'Jane Smith'; -- Accessing elements DBMS_OUTPUT.PUT_LINE('First contact: ' || myContacts(1)); DBMS_OUTPUT.PUT_LINE('Second contact: ' || myContacts(2)); END;

AlCoholic69

Livesql CREATE TYPE PhoneBook AS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER; Errors: TYPE PHONEBOOK Line/Col: 0/0 PL/SQL: Compilation unit analysis terminated Line/Col: 1/19 PLS-00355: use of pl/sql table not allowed in this context

Aditya

D is not correct, we can't create index by table in the database, only varray and nested table can create in database.