Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ORACLE SQL Write a PL/SQL anonymous block that will process records stored in the emp table (table that is created as part of the starter

ORACLE SQL

Write a PL/SQL anonymous block that will process records stored in the "emp" table (table that is created as part of the starter database which was created during the Oracle 11G database installation). The program must perform the following tasks.

1. Declare the required types and variables to store both the employee name and salary information (i.e., a counter variable may be needed also as an index).

2. Use a loop to retrieve the first 10 "ename" and "sal" values for records in the "emp" table , store in two variable array of 10 elements (i.e., one array will store the name; the other array will store the salary)

3. Use another loop to display the "ename" and "sal" information in the reverse order (i.e., use the "REVERSE" option of the for-loop syntax).

Notes:

Use pseudocolumn "ROWNUM" (refer to "Oracle 11G SQL Reference" documentation, http://docs.oracle.com/cd/E11882_01/server.112/e41084/pseudocolumns.htm#SQLRF0025 (Links to an external site.)Links to an external site. ) to limit number of salaries to select to 10

FOR loop syntax described at the following link, http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/controlstatements.htm#LNPLS411 (Links to an external site.)Links to an external site.

Use describe command to determine the data type for the "ename" and "sal" fields of the "emp" table

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

1. Identify three approaches to culture.

Answered: 1 week ago