Please enable JavaScript.
Coggle requires JavaScript to display documents.
MyNewLearning (Pl/Sql (Variables (Collections (Assicative array (AA)…
MyNewLearning
Pl/Sql
Variables
Records
-
User defined
syntax:
type my_t is record (field_name filed_data_type, filed 2...);
rc my_t;
example:
declare
type my_t is record ( bn varchar2(10), un unique_number bsscpf.unique_number%type); -- unique_number%type, must follow with %type and varchar2( initialization number) is needed.
my_r my_t;
begin
select bschednam, unique_number into my_r from bsscpf fetch 1 rows only;
end;
Collections
Assicative array (AA)
-
-
-
-
20201227: AssociativeArray, was known as index-table prior of Oracle 9i. This is basically one dimensional data. Generally two column tables. First column is index seconds column is homogeneous values. The minimal use case I can think of this AA is for having lookup type of information. Which can be sent from Java as well, using jdbc#setPlsqlIndexTable. But beyond that it has no major advantage like join with tables not possible with AA. There NT wins.
Nested Tables (NT)
similar to associated arrays; except
(A) no "index by".
(B) not initialized by default so, necessary to initialize
(C) and necessary to extend
(D) two NT can be compared, but not AA
(E) mulitset operators possible on NT not on AA
(F) delete of elements possible from NT
(G) NT can be stored in db columns but AA cannot.
-
-
-
Cursor: The ref cursor or the cursor variable causes lots of soft parse if it is called many times. Like in getautonum.
Ideally we should try to avoid using cursor variable, as we can use the associative array to return. If we still have to use the cursor variable then to make soft parse really soft set the appropriate value of parameter: session_cached_cursors to reduce the effects of latching contention. Ref: Expert PL/SQL Practices, Chapter 10.
Bulk Collect works better with the parameter setting as:
plsql_optimize_level = 2 (or more). 10g onwards it is 2.
alter sesssion set plsql_optimize_level = 2;
Ref: Expert PL/SQL Practices Chapter 6. P134.
-
Java8NewThings
-
-
CompletableFuture
Main Difference compared to Future is that it can return exception. Like CompleteExceptionally.
It provides a method called supplyAsync. It is easiest to convert sync method to async method.
Maven
-
-
Compile specific module:
mvn install -pl :B -am
if the module name is different than the directory name then need to prefix with colomn :.
mvn -pl A,B,F -amd clean install
if want to specify multiple module.
enum
Enum can implement interface in Java.
Most useful thing could be to have set of codes. And for those set of codes we write switch case. The code can be provided from outside as well.
-
Oracle
Memory Structures
Some OS configuration are incompatible with AMM,e.g: Linux HugePages. P128 of book EODA
PGA
PGA is never allocate in Oracle's SGA
PGA is private and specific to process, never shared across process
Mainly utilized for in-memory sorting, bitmap merging and hashing
Manual PGA Setting
The parameters having largest impact on the PGA size
- SORT_AREA_SIZE (SAS)
- SORT_AREA_RETAINED_SIZE (SARS)
- HASH_AREA_SIZE (HAS)
- SAS: The amount of RAM used for sort, before it starts swapping to temporary tablespace.
- SARS: The amount of sorted data retained in RAM
- HRS: The hashjoins sets are stored in memory. The smallest hash set is stored and other hash set is stored in temporary tablespace.
-
Automatic PGA setting
-
The automatic PGA memory management was designed for multiuser "fair". If we have only one session like night batch, in those cases we can take control and change the SAS|HAS. As reining in with these limits will cause I/O on temporary tablespace
-
-