You're reading from Developing Robust Date and Time Oriented Applications in Oracle Cloud
Chapter 1 – Oracle Cloud Fundamentals
- D is correct. All the aspects are covered by OCI.
- B is correct. Analytical databases focus on complex data retrieval, aggregations, and analytical queries. The performance of the retrieval process is ensured by the indexing, which is mostly reflected by the B+ trees and bitmap index types.
- D is correct. ATPs are defined by small online transactions and are covered by the
TP
and the higher priorityTPURGENT
. - C is correct. The user is not responsible for the platform or the infrastructure. Applications are located in the cloud, and the whole administration is vendor operated and administered.
- D is correct. The archiver process takes the online logs and copies them into the archive repository before they are rewritten. Log Writer is responsible for transactions by managing the changes and storing them in the online logs. The Process Monitor background process manages sessions and server-client interconnection. System Monitor...
Chapter 2 – Data Loading and Migration Perspectives
- A is correct. SQL Loader is related to the third-party systems holding the data to be imported. Multiple file types and structures can be used. The essential element in this process is the instruction set defined in a control file, which specifies how to import/load and map the data from the external file, including handling undefined values and other loading instructions.
- C is correct.
Exp
andImp
methods are operated on the client side. - A is correct. We have used this method to make the log available through Object Storage.
- C is correct. The pre-authenticated request consists of several elements.
B
defines the bucket andO
defines the object name.
Chapter 3 – Date and Time Standardization Principles
- A is correct. It takes preferences to the top-level precisions, thus the year is first, followed by the month and day elements.
- A is correct.
T
encloses time elements. - C is correct. It refers to the Gregorian calendar.
- D is correct. Unbounded periodicity is expressed by the value
-1
after theR
designation.
Chapter 4 – Concepts of Temporality
- A is correct. UTC is used for the normalization reference.
- C is correct. The client time uses the UTC reference extended by the time zone shift definition, whereas local time applies the time zone directly to the value itself.
- C is correct. The Gregorian calendar correctly applies the current rules for the leap year definition.
- If he was 17 the day before yesterday, he must have had his 18th birthday yesterday.
- In order for him to be 20 next year, he must be 19 this year. So, today must be the beginning of the year – January 1.
- The timeline is shown in Figure A.1:
Figure A.1 – Solution: time positions
Chapter 5 – Modeling and Storage Principles
- C is correct. Microsecond precision is used by default, consisting of six decimal places.
- B is correct.
DATE
can operate up to second precision, whereasTIMESTAMP
uses nanosecond precision. - C is correct.
DATE
andTIMESTAMP
cannot hold time zone references. UsingTIMESTAMP
with a local time zone incorporates the shift between the server and client directly into the value itself during retrieval and processing. - A is correct. There is a
TIMESTAMP
keyword followed by the element value definition. There is no explicit mapping definition, so the order of elements must apply the predefined format. - D is correct.
SYSDATE
andCURRENT_DATE
provide theDATE
data type.systimestamp
provides the database’s time zone andlocaltimestamp
provides the client side’s time. - D is correct. Oracle provides the number of days elapsed when two
DATE
values are subtracted. - A is correct. Oracle provides
INTERVAL DAY TO...
Chapter 6 – Conversion Functions and Element Extraction
- B is correct. The format is
RM
. - A is correct. The
D
andDDD
formats provide numerical output.DY
is textual but provides only abbreviations.DAY
provides the full name. - C is correct. By default, the 12-hour format is used, so
HH
andHH12
are the same. TheHHEurope
format does not exist. The 24-hour format is referenced byHH24
. - D is correct.
DATE
,TIMESTAMP
, andINTERVAL
types are permitted values forEXTRACT
function operations.
Chapter 7 – Date and Time Management Functions
- A is correct. The query takes the provided date and adds one month, resulting in the last day of February. Since 2023 is not a leap year, February 28, 2023, is the result.
- A is correct. Any numerical value can be produced, even negative.
- D is correct. Languages and regions influence the output of the
NEXT_DAY
function. This is why we implement theown
function, which is not influenced by the NLS parameter values. - B is correct. The
Q
parameter value is used for quarter trimming.CC
trims based on the whole century. - D is correct. The
PERSONAL_ID
value is an interesting concept of person identification; it is formed by the date of birth and gender applied for the month elements.
Chapter 8 – Delving into National Language Support Parameters
- A is correct.
NLS_DATE_FORMAT
is a static parameter, and the instance must be restarted to apply the change stored inSPFILE
. - B is correct.
NLS_TERRITORY
references the first day of the week, whether it is a Sunday or a Monday. - B is correct.
NLS_DATE_LANGUAGE
can be defined by the third parameter of theTO_CHAR
function. - D is correct. For the system (database), the
NLS_DATABASE_PARAMETERS
data dictionary should be referenced. Session-level values can be obtained by theNLS_SESSION_PARAMETERS
data dictionary. The other definitions (options B and C) are not valid data dictionary structures.
Chapter 9 – Duration Modeling and Calculations
- A is correct. Undefined states cannot be covered; each new state automatically marks the end of the validity of the direct predecessor.
- B is correct. The right-side open characteristics expresses the first timepoint, which is invalid for the duration spectrum.
- C is correct.
DATE
value subtraction produces day granularity. - C is correct.
INTERVAL DAY TO SECOND
is produced.
Chapter 10 – Interval Representation and Type Relationships
- C is correct. The left border remains the same. The right border is extended by one day to March 1 because 2022 is not a leap year.
- C is correct. The
not_fills
relationship type does not exist. Theoccupies
type characterizes the common start or end point or the whole coverage. Theexcludes
category coversbefore
andmeets
types, which do not overlap. - C is correct. If there are no undefined states, each beginning point of the validity ends the validity of the direct predecessor. Thus, no gaps can be present.
- B is correct. The
PERIOD
definition takes the name specified after theFOR
keyword by extending its name with_START
or_END
. Therefore, if it is specified asPERIOD FOR VALIDITY
, then the name of thePERIOD
border attributes in this case would beVALIDITY_START
orVALIDITY_END
. - A is correct. In principle, there are three options –
ALL
,CURRENT
, andASOF
, extended by theQUERY_TIME
parameter...
Chapter 11 – Temporal Database Concepts
- D is correct. The model takes two layers. The first is formed of the primary key and references. Individual object states are temporally oriented and part of the second layer. From the temporal perspective, historical, current, and future valid data can be managed.
- A is correct. A conventional system stores only current valid data. Any change invokes physical replacement of the original state.
- C is correct. The aspect of relevance is related to identifying significant changes. Transaction support covers the integrity of transaction rules in a temporal environment. The aspect of correctness relates to extended temporal data integrity, like a temporal ISA hierarchy. The aspect of limited temporal usability is related to the important loss of historical states and future plan management.
- C is correct. Three dimensions are covered – Insert, Preprocessing, and Load.
- B is correct. In this case, the best option is...
Chapter 12 – Building Month Calendars Using SQL and PL/SQL
- B is correct. It is necessary to remove all elements lower than the month itself. This can be done with a truncating operation. Values can be rounded up. The
first_day
function does not exist and should be user defined. And finally, theEXTRACT
function gets only one element, not theDATE
value. - C is correct. First, increase the original value (
sysdate
) by one month, then truncate its value. Finally, one day is subtracted, providing midnight of the last day of the month. Thelast_day
function keeps the original time elements.TRUNC(sysdate) + 1
adds one day and removes time elements. TheROUND
function cannot provide these results.
Chapter 13 – Flashback Management for Reconstructing the Database Image
- C is correct. The isolation property of the transaction ensures access to the confirmed changes.
- C is correct. The System Change Number (SCN) is Oracle’s clock, which is incremented every time a transaction is committed. SCN marks a consistent point in time in the database.
- B is correct. The
FLASHBACK DATABASE
command can only be launched inMOUNT
mode. - A is correct. Syntactically, the
AS OF SCN
clause is used, followed by the SCN value.
Chapter 14 – Building Reliable Solutions to Avoid SQL Injection
- We are pleased that you have realized the importance of the correct access and processing of date and time and have applied the principles of reducing the possibility of SQL injection in your solutions.
- D is correct. You have to specify valid conditions. For option D, the
WHERE
clause looks like this:employee_id=1
or 1=1
.
Chapter 15 – Timestamp Enhancements
- A is correct. The client time zone is obtained by
SESSIONTIMEZONE
. The server time zone can be obtained by theDBTIMEZONE
function of theSTANDARD
package.MYTIMEZONE
andUTC_SHIFT
do not exist in that package. - D is correct. The time zone can be stated using the valid name representation or with numerical values using time zone hour (
TZH
) and minute (TZM
). - C is correct. The
DATE
value is transformed into aTIMESTAMP
reference and extended by the time zone reference, forming theTIMESTAMP with time zone
data type. - B is correct. The
FROM_TZ
function takes two parameters.TIMESTAMP
is a constructor, andAt time zone
is aTIMESTAMP
clause extension, not a function. The only valid option isNEW_TIME
. - D is correct. The valid UTC normalization for the
TIMESTAMP
value is done by theSYS_EXTRACT_UTC
function.
Chapter 16 – Oracle Cloud Time-Zone Reflection
- A is correct. Option B does not reflect the destination by using
ALTER SESSION
. TheUnset
command is not correct (option C). TheDeregister
clause does not exist either (option D). - C is correct. The difference between the database (server) and client time zone is 16 hours.
SYSDATE
refers to the server time zone andCURRENT_DATE
is the client time. Based on the settings,SYSDATE
refers to the smaller value, therefore the output value provided by the query is-16
. If theSYSDATE_AT_DBTIMEZONE
parameter was set tofalse
, the database time zone would not be applied, so the difference would be 10 hours, resulting in a negative value. Therefore, the output of the query would be-10
.
The rest of the chapter is locked
You have been reading a chapter from
Developing Robust Date and Time Oriented Applications in Oracle CloudPublished in: May 2023Publisher: PacktISBN-13: 9781804611869
© 2023 Packt Publishing Limited All Rights Reserved
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime