Include Toad-family sites
ORACLE
SQL SERVER
IBM DB2
MYSQL
SYBASE
CLOUD DB
OTHER RDBMS
Toad World
ORACLE
Steven Feuerstein's PL/SQL Obsession
Puzzles and Quizzes
Aug 2007: The Right Datatype for the Job
WELCOME, GUEST
Login
/
Register
Powered by Quest Software
Toad World Puzzler - August 2007
The Right Datatype for the Job
PL/SQL comes with lots of different types of data: strings, numbers, dates, collections, cursor variables, records, etc.
This month's puzzle is a matching game. Assuming you have an Oracle Database 10g Release 2 installation, match the datatypes listed below to the scenarios to which they would best be applied.
Scenarios
I work at Toys Galore! and I used BULK COLLECT to query all the toys in the "BOARD GAMES" category into a collection of records. I need to apply a formula to transform the internal product identifier codes (alphanumeric) and then display the products ordered by these new codes.
We are using an Oracle database to keep track of readings from a laboratory instrument. Data is generated every two-hundredth’s of a second and I need to record the time of acquisition.
Either the customer status is active or inactive; in the database, this information is stored as a Y or N value in a CHAR(1) column. When I manipulate account information in my PL/SQL program, I will use this datatype instead to track the status.
We celebrate the birthdays of employees in our company. I am writing a program to print out the days of month on which there are birthdays. I have two lists defined in my PL/SQL procedure: the days of the month of salaried and hourly workers. I need to merge them together into a single list that contains no duplicates, and then display the days of the month.
Sometimes I need to fetch from the department table, sometimes from the employees table, and in all cases I need to pass the dataset back to the Java frontend applet.
A. Timestamp
1.
2.
3.
4.
5.
B. String indexed collection
1.
2.
3.
4.
5.
C. Weak ref cursor
1.
2.
3.
4.
5.
D. Boolean
1.
2.
3.
4.
5.
E. Nested table of integers
1.
2.
3.
4.
5.
Submit