Just a javascript file which can import functionality from other and export its own functionality.
The industry-standard protocol for authorization.
This specification and its extensions are being developed within the IETF OAuth Working Group.
Smaller, more expressive, more robust.
VS Epxress
The key difference between Koa and Express is how they handle middleware. Express includes routing and templates in the application framework. Koa, on the other hand, requires modules for these features, therefore making it more modular or customizable.
Functions follow the computer-science definition in that they MUST return a value and cannot alter the data they receive as parameters (the arguments). Functions are not allowed to change anything, must have at least one parameter, and they must return a value. Stored procs do not have to have a parameter, can change database objects, and do not have to return a value.
1 | -- create a procedure: |
1 | create table customers ( |
A cursor is a pointer that points to the result of a query.
There are two types of cursors:
Cursor attributes
Attribute | Description |
---|---|
%FOUND | Returns TRUE if an INSERT, UPDATE, or DELETE statement affected one or more rows or a SELECT INTO statement returned one or more rows. Otherwise, it returns FALSE. |
%NOTFOUND | The logical opposite of %FOUND. It returns TRUE if an INSERT, UPDATE, or DELETE statement affected no rows, or a SELECT INTO statement returned no rows. Otherwise, it returns FALSE. |
%ISOPEN | Always returns FALSE for implicit cursors, because Oracle closes the SQL cursor automatically after executing its associated SQL statement. |
%ROWCOUNT | Returns the number of rows affected by an INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement. |
If you run the examples in PL/SQL Developer, remember to run the code of the procedure creation in a program windows instead of a sql window. Sql window does not throw errors!
1 | DECLARE |
1 | DECLARE |
1 | CREATE OR REPLACE PROCEDURE greetings |
1 | DECLARE |
1 | DECLARE |
1 | DECLARE |
1 | CREATE TABLE employee ( |
This creates the following data:
EMP_ID | FIRST_NAME | LAST_NAME | DEPT_ID | MANAGER_ID | OFFICE_ID |
---|---|---|---|---|---|
1 | Sally | Jones | 3 | 2 | 5 |
2 | Mark | Smith | 2 | 4 | 3 |
3 | John | Andrews | 1 | 4 | 3 |
4 | Michelle | Johnson | 2 | 5 | |
5 | Brian | Grand | 2 | 2 | 3 |
1 | WITH d_count AS |
1 | WITH cteEmp(emp_id, |
EMP_ID | FIRST_NAME | MANAGER_ID | EMPLEVEL |
---|---|---|---|
4 | Michelle | 1 | |
2 | Mark | 4 | 2 |
3 | John | 4 | 2 |
1 | Sally | 2 | 3 |
5 | Brian | 2 | 3 |
The above result is generated in the following process:
where manager_id IS NULL
, which returns one row;UNION
query connecting a initial qery and a recursive query.FROM employee e, cteEmp r WHERE e.manager_id = r.emp_id
associates the original table with data from the initial query, returning more data;1 | -- Normal |
Build options:
Refresh types:
Trigger types:
Prebuilt:
Schedule:
START WITH ... NEXT ...
specifies a schedule.A materialized view can be refreshed either manually or as part of a refresh group or via a schedule.
Refresh manually:
1 | EXEC DMBS_MVIEW.refresh('mvt1'); |
Create a refresh group:
1 | BEGIN |
Create a schedule(must be specified at the creation of the materialized view):
1 | create materialized view mvt1 |
The materialized view mvt1
will be refreshed every minute. An Oracle job is also created at the same time.
To find out the job id, use this query:
1 | select m.owner, m.mview_name, r.job |
mvtt
:ind | name |
---|---|
1 | a |
1 | create materialized view mvt1 |
Now mvt1
has the same data as mvtt
. Insert a new row will not trigger an update in mvtt
because its trigger type is on demand
.
analytic_function([ arguments ]) OVER (analytic_clause)
[ query_partition_clause ] [ order_by_clause [ windowing_clause ] ]
1 | CREATE TABLE emp ( |
1 | SELECT empno, deptno, sal, |
NULL
values to last in ASC
order and first in DESC
MAX
and MIN
ignores NULL
values1 | SELECT empno, |
order_by_clause
, can only be used when order_by_clause
is present.order_by_clause
, a default windowing clause is attached: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
1 | RANGE BETWEEN start_point AND end_point |
1 | SELECT empno, deptno, sal, |
1 | SELECT empno, deptno, sal, |
LAG
: Access the row at a given offset prior of the current row without using a self-join.1 | LAG(expression [, offset ] [, default ]) |
1 | SELECT e.empno, |
SUM
also supports windowing:1 | SELECT e.empno, |
1 | create public database link |
1 | -- user和password都不需要引号,如果passwrd有特殊字符,那就用双引号""包起来 |
Find all database links:
INSERT ALL
to insert multiple rows:1 | CREATE TABLE employee ( |
1 | CREATE OR REPLACE FUNCTION MD5( |